[Help] Calculate Turnover Trade-wise - FIFO Method (Excel VBA)


Well-Known Member
I posted this in another thread expecting some response, but it got buried. So the reason for starting a separate thread. Hope I am not violating forum rules.
x ----------------------x----------------------x​
Hi Guys!!!

Do anyone have/know any tool for calculating turnover tradewise - FIFO method?

Zerodha is giving trade wise turnover report, pretty much every other broker only giving contract wise net position report. I have been doing this manually for some years now. I tried several times googling over the last few years to see if there is any tool/excel sheet. Though I have found some, but not much of a use. Only one was close to what I was looking, but that's not a perfect one and the calculations weren't right. Since I don't know VBA, not a lot I could do with that file.

Recently I pulled that file from archive and tried to find some solution, but couldn't understand much.

I am uploading that file, if anyone know VBA and can fix it, that would be helpful for us. Excel related forums is not much of a help in this regard. I have tried few times over the years but no response. I guess it's too complex.

Errors I could spot in the file.
- Even though, both purchase and sale qty is equal, excel throwing error saying sell qty is higher than buy qty
(in fact, it would be better if there is a qty difference on one side, code should assume the price is 0 for that qty and calculate. That includes even if there is no exit from the position i.e, only long/short entry and no exit - - sell/cover) - So this means the calculation for totaling qty is wrong.
- If we use only one ticker, it wouldn't through error but exclude the excess qty if it's in the sell side. If in buy buy side, it would show as unsold qty.
I have tried lot of things. So the data in Purchase and Sales worksheet (where we put our data) you see is not the original, that's something I entered to check.

I don't know what else are wrong in this file. But the one who made this did some good job.

PS: This file is downloaded few years ago from online when googling. No idea about who made this file or from where exactly I downloaded this file.


Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Are you a day trader?