[Math] How to calculate weighted mean with negative weights

average

This might be very trivial for you guys.
If :
I buy 2 oranges for 5 dollars each then
I buy 3 oranges for 6 dollars each and then
I sell 3 oranges for 4 dollars each

How do I calculate the average price of an orange ?
thanks.

Edit 1

I will elaborate :
I need to show in software the amount of the product and the avg price.
So , if lets say I bought 4 ranges for 100 usd each.
and I sold 2 oranges for 110 usd each.

I now present in my systems 2 oranges – and in what price?

Option A: (4 * 110 + 2 * 100)/6 = 106.667
or
Option B: (4 * 110 – 2 * 100)/2 = 120 (doesnt think so )

If I do go with option A then if I sold 2 more for 110
I would get 0 amount but average (4*100+2*110+2*110)/8 – 105 . 0 stocks for 105 doesn't make any sense.

(I beleive I want to be able to say amount*price – this is what I have, cause I want to show "How Much Do I Worth")
Thanks A lot

Best Answer

You're a bit vague about what you mean by "average" price. Do you mean the average price you paid for oranges or the average price oranges were transacted on the market. If the first, you account for the ones you sold as an income instead of a loss, so you should give it the opposite sign. But if you just are interested in the average price at which transactions occurred, not accounting for whether they were sold or bought, then the simple formula with absolute values is OK. What do you want?

Suppose you're interested in the average price you paid for the oranges.

You have used an amount of money equal to $2\times 5+3\times 6-3\times 4=16$ dollars to pay for oranges. You are left with two oranges, so you could say the average price per orange you paid is $8$ dollars.

On the other hand, if you're interested in the average transaction price, then you might need:

$$\frac{2\times 5+3\times 6+3\times 4}{2+3+3}=5 \text{ dollars.}$$

In your edited version, you say you want to evaluate "worth", I think averages are not really useful. Totals would be more useful. In fact, a good double-entry bookkeeping system that keeps track of your amount of oranges and your capital would be more useful here.

Related Question