Molecular Weights 11

I wouldn’t normally publish a post on such an esoteric topic as this. However, since the idea for it came as a result of a challenge posed by the venerable David Hager, I felt that I could not resist.

And that challenge was as follows: given a list of chemical elements and their respective atomic weights, a formula to determine the weight for a given molecule.

It goes without saying that there are numerous quick and easy online applications which will perform such a calculation. Nevertheless, and however unlikely it may seem, there is still a small probability that this post will reach one or more of the tiny minority who have a practical need for such calculations to be performed within Excel (and, in addition, perhaps without recourse to VBA).

As an example of what is required, given aluminium sulphate (or sulfate if you prefer), Al2(SO4)3, we would expect a result of 342.15 (to 2 d.p.), since one molecule of this compound comprises, in total: 2 atoms of aluminium, 3 of sulphur and 12 of oxygen, and, using the table provided, we can sum up the relevant amounts to arrive at that value.

Assuming that the single-column ranges containing the elements and weights are defined as Sym and Wgt respectively (you can download the workbook here), and that we further define, relative to row 2, Arr as:


the required array formula** in B2 is then:


Note that this set-up is limited to compounds whose largest single numeric does not exceed 99. So, for example, it will fail on something like:


for example, (though:


would be perfectly fine).

Due to the length and complexity of the above, I hope readers will not mind too much if I pass on an explanation! However, I would be more than happy to respond to any queries as to how it works and/or suggestions for improvement.

Thanks again to David for being the inspiration for this one. Another post to follow shortly. Watch this space!


  1. @Flora

    Can you give me an example of a compound for which that site gives a different result? For the example I gave, Al2(SO4)3, that site also gives a result of 342.15 (to 2 d.p.).


  2. To be clear, my intention was less of a challenge and more of a realization that the formula techniques you have developed would make you capable of creating this formula. Congratulations!

  3. Hello XOR LX,

    My molecules have gathered together to catalyze an atomic “Congratulations” … !!!

  4. Pingback: #Excel Super Links #1 – shared by David Hager | Excel For You

  5. An amazingly ingenious solution. I never can make my mind up whether to be in awe of such ‘too clever by half’ approaches or horrified by them. One idea that you might like to comment on is that of representing reusable fragments of formulas as Names. For example







    The formula symLen to determine whether the Symbol name has one or two characters is still alarmingly devious but the use of a name encapsulates the complexity and leaves a meaningful expression that could be documented (under Name.Comments).

  6. Pingback: LAMBDA Excel: Molecular Weight | Excel For You

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.