Merging and Summing in Excel - Vlookup?

ExcelNewbie150

New Member
Joined
Mar 6, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello

For a school project I have to analyze a stock portfolio with several lines of the same stock – Only thing that changes is the number of shares and the % of P&L like so



SideStockPrice% P&L
BuyExxon Mobile20.950.0025
BuyExxon Mobile180.0014
BuyExxon Mobile20.10.0025
SellExxon Mobile210.008
SellExxon Mobile210.0016
BuyShell Plc29.320.0001
BuyShell Plc29.150.004




I would like to create a new spreadsheet in the workbook that merges and sums the lines like so:

SideStock% P&L# Trades
BuyExxon Mobile0.00643
SellExxon Mobile0.00962
BuyShell Plc0.00411


where % P&L is the sum for all buys and this stock, # Trades the count of all trades for this side etc... I know this involves sums and countifs...but not so sure about how I go to create one line per item- Can you help?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try with Pivot Table like this

1. Create Pivot Table (Insert -> Pivot Table -> From Table/Range -> Select Table/Range) or ( Alt + N + V + T)
2. Input "Side" and "Stock" in the "Rows" section, and input "%P/L" in the "Values" section twice and set the "Value Field",


1709801153287.png
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,130
Members
453,021
Latest member
Justyna P

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