Excel formulas to calculate average price and P/L for open and closed stock positions
Budget: $30 – $250 USD
Hi,
I have an excel sheet to register my stock purchases. (sample file is attached)
It has 3 worksheets.
I will only input the data at the "transactions" sheet.
The values at "open" and "closed" sheet should be calculated with formulas.
A sample stock transaction can be as follows:
BUY 100 shares at 10usd
BUY 50 more shares at 12usd
BUY 50 more shares at 14usd
Open shares: 200, average price:11,5 this should show in open positions worksheet
Then, I sell 200 shares at 10usd.
After this transaction. Since the position is closed. This ticker should not show up in OPEN positions worksheet.
It should show in CLOSED positions worksheet with 300usd profit.
Then, I make the following transactions:
BUY 100 shares at 15usd
BUY 50 shares at 20usd.
Now, the OPEN position worksheet should show 150 shares with 16,67usd average price.
So, in summary, when the trailing quantity is higher than zero, The OPEN worksheet should calculate the last batch of the open position. It should take into account any previous batches. All previous batches' P/L should be calculated in the CLOSED worksheet.
PLEASE, KEEP IN MIND THAT I will only input data in the transactions sheet. The list in OPEN and CLOSED worksheet should be populated automatically
I have an excel sheet to register my stock purchases. (sample file is attached)
It has 3 worksheets.
I will only input the data at the "transactions" sheet.
The values at "open" and "closed" sheet should be calculated with formulas.
A sample stock transaction can be as follows:
BUY 100 shares at 10usd
BUY 50 more shares at 12usd
BUY 50 more shares at 14usd
Open shares: 200, average price:11,5 this should show in open positions worksheet
Then, I sell 200 shares at 10usd.
After this transaction. Since the position is closed. This ticker should not show up in OPEN positions worksheet.
It should show in CLOSED positions worksheet with 300usd profit.
Then, I make the following transactions:
BUY 100 shares at 15usd
BUY 50 shares at 20usd.
Now, the OPEN position worksheet should show 150 shares with 16,67usd average price.
So, in summary, when the trailing quantity is higher than zero, The OPEN worksheet should calculate the last batch of the open position. It should take into account any previous batches. All previous batches' P/L should be calculated in the CLOSED worksheet.
PLEASE, KEEP IN MIND THAT I will only input data in the transactions sheet. The list in OPEN and CLOSED worksheet should be populated automatically