Pivot table - How to calculate a weighted average
I'm trying to come up with an average price for each stock in a stock portfolio of 25 stocks, where each stock has a number of different buys over time, each time with different lot sizes and purchase prices
Creating a pivot table that shows a row for each stock, with total cost and total shares is easy. However I can't figure out how to divide the two to come up with an average price. I'm currently copy/pasting the pivot table data into another table, then adding a formula column. But this seems pretty inelegant.
Does anyone have any suggestions? Is there an elegant solution?
MacBook Pro 13″, macOS 11.1