In chemistry, a mole is a quantity unit that stands for the amount of a substance. One mole of any chemical compound contains the same number of molecules that equals to Avogadro Constant (6.022 x 10^23). Thus, to calculate the number of molecules, you only need to know the compound amount in moles. The latter is typically computed using the mass.

Analyse the chemical formula of the compound to determine elements that compose it. For example, if the compound is sodium sulphate, Na2SO4, elements are sodium (Na), sulphur (S) and oxygen (O). Note that digits after the element symbols indicate the number of corresponding elements in the molecule.

Find the element symbols in the Periodic Table of the Elements, and write down atomic weights of each element given under the symbols. In that example, the atomic weight of sodium (Na) is 23; sulphur (S) is 32; and oxygen (O), 16.

Multiply the atomic weight of each element by its number in the molecule, and then sum up all products to calculate the compound molar mass. In the example, the molar mass of Na2SO4 is (23 x 2) + (32 x 1) + (16 x 4) = 142g/mole.

Divide the mass (in grams) of the compound by its molar mass to calculate the amount in moles. For example, the mass of Na2SO4 is 20g. Then the number of moles is 20 /142 = 0.141 (rounded to the thousands)

Multiply the number of moles by the Avogadro Constant, 6.022 x 10^23, to calculate the number of molecules. In the example, the number of molecules of Na2SO4 is 0.141 x 6.022 x 10^23 = 8.491 x 10^22.