on your sheet opening balance you have
listed twice with two different amounts, and on your data sheet your dont.
so one has 13 and one has 12 enrtys. as for the math it all looks like it works fine, what exactly is it doing wrong.
or what do you want it to do different.