# calculate minimum sale price of stocks

I have the following table (see image). Here I want to calculate (simplified) the minimum sale price. Currently I just devide the balance through the amount of stocks. The balance itself is calculated by adding the sum of all efforts and proceeds. If I'm not wrong this results in a min selling price that garantuees no overall loss (ignoring selling fees).

Problem is of course you want to take away your profit and calculate the selling price on the resulting rest. So in this easy example I would want to get:

`(10 * $191.97 + 9.82)/10 = $192.952`

How do I calculate this (in LibreOffice Calc)? (of course without calculating it just manually on that row)