Compute average weighted price using FIFO

ETH20k

New Member
Joined
Mar 26, 2022
Messages
4
I have a growing list of stock purchases & sales over time.

The list indicates in order: Transaction #, date, stock name, price $, quantity, total volume $.

Each divestment or investment has a different quantities and pricing, as I am doing dollar cost averaging.

Next, I have a Profit & Loss (PnL) overview section, summarising the information of the table mentioned above.

To calculate the overall PnL of the portfolio, I need to compute the weighted average purchase and average sales price of each individual stock class first. How do I do that?
The underlying idea is to follow the FIFO (accounting; first in, first out) methodology. So when I sell a stock, I want to sell the "oldest" stock first.

Here is an example, using the same stock name only.
Day 1. My first purchase is 100 stocks at $2 so my average purchase cost is $2. Easy so far.
Day 2. I sell -50 at $3 so I have 50 left and my average cost is still $2 per share, whereas my average sales price is $3 now. Still easy.
Day 3. Now I sell the remaining -50 at $4 so I have 0 stocks left, so no inventory. Any profit/loss doesn't matter as that's a different calculation. Weighted average sales price was $3.5. Important: Since the inventory went to 0, no average should be carried forward.
Day 4. I buy 100 at $1... New average purchase cost $1 USD etc.
Day 5. ... another 200 at $1.5...
Day 6. I sell -15 at $2 and buy 25 more at $1.75 and so on.. & on.. making it more complicated to keep up.
 

Attachments

  • Screenshot 2022-10-13 at 12.12.32.png
    Screenshot 2022-10-13 at 12.12.32.png
    156 KB · Views: 73

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Calculate weighted average purchase price of asset on FIFO basis
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,988
Members
449,093
Latest member
Mr Hughes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top