Hmm?
I cannot follow your logic.
1/. The first part is easy to match with your sample
Use a helper column "Helper1 (Last Buy Price)"
In G2
In H2 "buy"
Drag/Fill Both Down.
This rightly or wrongly matches your Column "buy" (now Column I in this sample workbook)
2/. Because you intend to sell the stocks on a "last in first out basis" then "Helper2 (Last Buy Date)" might be used to return only the dates when stocks were bought.
In J2
Drag/Fill Down.
So far so good.
3/. Your formulae/calculations in Column "sell" make no sense whatsoever, to me at least.
The first calculation you have in this column is in row 4
Where does the 100 and 900 come from?
Prior to this you seem to have bought and sold equal amounts on each day, so therefore you are holding no stock at this time. Is that not correct?
From that point on I really can't follow anything!
4/. I have added some thoughts to the sheet, Columns N:Q, based on the last bought price.
This is only an attempt to follow your logic and will not hold true as it stands when the next client is reached.
Sorry I just don't understand how you can sell stocks you don't have then buy them back at the same price the following day...
... See rows 13/14. (Prior to row 13 your stock balance is zero.) That seems to be a nifty way to make $4365 ... 
Maybe this is why I am not an accountant/stock broker.
Bookmarks