Inelastic neutron scattering (INS) is an important experimental method for determining intrinsic magnetic parameters of magnetic materials. For the new hard magnets containing rare earth R and transition metal T ions these microscopic parameters describe for example the exchange and crystal field interactions. We have employed the INS method to determine with very good accuracy the intersublattice exchange coupling between the R Gd and T Fe sublattices in Gd 2 Fe 1 7 Gd 2 Fe 1 7 N 2 . 7 and Gd 2 Fe 1 7 C x with x = 0.5, 1.0 and 1.5. Although it is well known that the overall magnetic properties of N- and C-doped samples are considerably better than those of the pure compound Gd 2 Fe 1 7 we find a drastic reduction in the Gd-Fe exchange coupling in the doped samples.