Theoretical influence coefficients for x-ray fluorescence analysis of intermediate-thickness samples isproposed. The algorithm, derived from the Sherman equation, corrects simultaneously both absorption and enhancement effects in specimens with various thicknesses. The coefficients take into account all matrix elements, hence they have to be calculated using an iterative approach. Nevertheless, if matrix diversification is limited, the coefficients can be treated as constants for given mass per unit area of the specimen. Then the iteration can be avoided and calculations are simple and fast. The dependence of the influence coefficients on matrix composition and sample thickness is discussed. The validity of the proposed algorithm was checked with certified geological materials, four-element polycrystals and ferroelectric ceramics using wavelength-dispersive x-ray spectrometry.