In my class my teacher showed us how to find the average atomic mass of an element with a method, but he didn't really state a formula one could use. I came up with a formula of my own, and from what I observed it works: $$ \frac{i_1x + i_2y}{100} = A, $$ where $A$ is the atomic mass, $i_1$ is the first isotope's atomic weight, $i_2$ is the second isotope's atomic weight, $x$ and $y$ are the percentages of the isotopes, respectively, and they add up to 100, i.e. $x+y = 100$.
Therefore: $$ \frac{i_1x + i_2(100-x)}{100} = A $$
I'm just wondering, is there an official formula, or is this method it?