Convert stock buys and sells into offsetting trades

BillJones984

New Member
Joined
Jul 3, 2018
Messages
1
Hi and thanks in advance for the help!

I need to convert stock buy and sell requests into matched offsetting trade transactions. The Buys and Sells here are the inputs and the trades are the outputs.

Answers in PQ are preferred but VBA or Excel are fine too.


InputsOutputs
BuySellTradesComments
AccountStock$ PriceAccountStock$ PriceAccountStockBuy $StockSell $
JimBIDU1500JimSBUX1900JimTSLA200REGN200
JimTSLA200JimREGN1100JimAMZN300REGN300
JimAMZN300JimTMUS100JimMSFT500REGN500
JimMSFT500SallyVOD500JimADBE100REGN100Need to sell $100 here so REGN is depleted
JimADBE600SallySIRI400JimADBE500SBUX500Remaining ADBE is purchased with proceeds from SBUX
SallyFB800JimBIDU1400SBUX1400SBUX depleted
SallyAMZN100JimBIDU100TMUS100Remaining SBUX purchased with proceeds from TMUS
SallyAMZN100SIRI100
SallyFB300SIRI300
SallyFB500VOD500
Total BuysJim3100Total SellsJim3100Net TradesJim0
Sally900Sally900Sally0

<tbody>
</tbody>
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,214,636
Messages
6,120,666
Members
448,977
Latest member
moonlight6

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