X-ray-absorption K-edge shifts of cobalt have been measured in ${\mathrm{Y}}_{2}$${\mathrm{Co}}_{17}$, ${\mathrm{YCo}}_{5}$, and ${\mathrm{YCo}}_{3}$ compounds whose crystal structures are derivatives of the ${\mathrm{CaCu}}_{5}$ structure. The edge shifts vary monotonically with the Y:Co ratio. We compare them with Fe, Y, and Ce edge shifts determined for several other related materials, including ${\mathrm{Y}}_{2}$${\mathrm{Fe}}_{17}$, ${\mathrm{Ce}}_{2}$${\mathrm{Fe}}_{17}$, and ${\mathrm{CeCo}}_{2}$. In all cases, the shifts are the same sign, a fact that points to the absence of a significant uncompensated charge transfer from one elemental constituent to another. Identifying the edge shifts as core-level shifts, we find that the Watson-Hudis-Perlman charge-compensation model is applicable to these systems; estimates of the model parameters lead to small net charge transfers consistent with available M\"ossbauer effect measurements. Our results show that there is no straightforward relation between the transition-metal magnetic moment and either charge transfer or corresponding absorption edge shift, which implies that the variation of the moment with stoichiometry in these materials is not governed by the filling of rigid transition-metal bands.