A usual technique in computational commutative algebra is to reduce the computation of invariants of ideals I⊆k[X] where k is a field, to the computation of the corresponding invariant of the monomial ideal M(I) which is associated to I (w.r.t. some term ordering) by means of Gröbner bases, via Buchberger’s algorithm. An early instance of this technique is Macaulay’s theorem: if I is homogeneous then: dimk(In)=dimk(M(I)n) for all n. This paper gives a general version of Macaulay’s theorem for ideals in polynomial rings over a noetherian ring R and any additive function λ. As a consequence, the computation of λ(I) for any ideal I can be reduced to the computation of λ(M(I)), for the associated monomial ideal. The result above is obtained by a study of the main properties of Bayer’s deformation.