I'm a complete idiot when it comes to mathematics, so please bear with me.
I have a problem. The average of the whole is different to the average of the sum of the parts. Why aren't they identical? Here are the numbers:
Item A Bought: 233.4 Sold: 246.7 Return (%): 5.6983718937
Item B Bought: 2710 Sold: 2595 Return (%): - 4.2435424354
Item C Bought: 1485 Sold: 1376 Return (%): -7.3400673401
Item D Bought: 893.11 Sold: 916 Return (%): 2.5629541714
Item E Bought: 214.2 Sold: 215.2 Return (%): 0.466853408
Return (A,B,C,D,E): - 2.8554303023% Average Return: -0.57108606046%
However, the average of total bought and total sold is different:
Total bought: (233.4 + 2710 + 1485 + 893.1 + 1214.2) = 5535.71 Total sold (246.7 + 2595 + 1376 + 916 + 215.2) = 5348.9
Return (%): -3.3746348707% Average Return: -0.67492697414%
Why this difference?
Thank you.
It may be clearer what's going on with a simpler example:
Item A: Bought at price $1$, sold at price $2$. Return $100\%$
Item B: Bought at price $99$, sold at price $99$. Return $0\%$
Overall: Buying: $100$, selling: $101$. Return $1\%$.
In fact to find the overall percentage return, you should take a weighted average of the individual percentage returns, with the weights being the buying price. That is the items that cost more to buy are weighted more heavily in the overall percent gain (or loss).