Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9786

Calculating weighted average when some values are negative

$
0
0

I'm trying to calculate the weighted average of stock prices but the problem is that some values are negative (where some but not all stocks were sold) and I can't figure out how to make it work.

Here is how I manged to do it with only positive values and it works fine:

Only positives

But if I try with some negative values added in I get an error:enter image description here

Any advice would be appreciated. Thank you!


Viewing all articles
Browse latest Browse all 9786

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>