Atomic masses listed on the periodic table are more accurately referred to as the relative atomic mass. This is because the atomic mass listed on the periodic table is an average of the atomic masses of all of the naturally occurring isotopes of the particular element. For example, carbon has isotopes C-12, C-13, and C-14. This means that the mass of each of these atoms is different because they all have a different number of neutrons (same number of protons) and neutrons have a mass that contributes to the overall mass of the atom. Scientists have calculated the average atomic masses using the percentage of each isotope typically found. The carbon 12 isotope is most common and that is why the mass is close to 12.
To find the atomic mass of a compound, you have to take into account the atomic mass of each individual element. You simply add the mass of each of the components to each other. Each unique compound has a different number of atoms of each element, so the atomic mass will vary. For example:
H2O: 1.01 + 1.01 + 16.00 = 18.02
H2O2: 1.01 + 1.01 + 16.00 + 16.00 = 34.02
Although these two compounds have the same elements, they have a different combination so they are different compounds which means they will have a different mass.
Periodic table, which is the most valuable in the study of inorganic chemistry has helped to estimate the actual relative atomic mass of elements and the discovery of new elements. A more rigorous study of periodic table, based on atomic mass has shown a series of obvious anomalies, for example, argon and potassium, iodine and tellurium, cobalt and nickel, judging by their properties, should not be placed correctly, according to their atomic masses. This anomaly has remained a long time unexplained, but it is known now that the atomic mass of an element is more important than relative atomic mass. These anomalies disappear when the elements are arranged according to atomic number.
For example, in order to calculate the molecular mass of C2H16, you have to do in this way:
[(2x12)+(6x1)]=24+6=30, where the mass of the Carbon atom is 12 and the mass of hydrogen is 1.