From Wikipedia,
Molar mass is
192.124 g/mol (anhydrous)
210.14 g/mol (monohydrate)
So in most applications like stop baths, they are close enough. Otherwise, you can convert 40 g of citr.acid monohydr. to mols: 40 g / (210.14 g/mol) = 0.1903 mol, and then, this to citr. acid anhydrous back to grams, 0.1903 mol * 192.124 g/mol = 36.57 g.
Or, you can calculate a ratio of molar weigths to get a conversion multiplier, or find such a multiplier from somewhere, I'm sure there are websites that list common conversion factors for most photographic chemicals.
Common substitutions are different amount of water in crystal and substituting Na salt for K salt or vice versa.