Excel profit/loss summary of items from another detailed log table

sagooo

New Member
Joined
Apr 26, 2017
Messages
1
Guys,

I have a trading log something like this in excel workbook -


ABCDEFGHI
1DateStock/ETFPriceQtyBuy/Sell/Deposit/Withdrawn/RHAdjustmentFeesTotalBalance
29/1/2016Deposit$100$100
39/29/2016MSTX$0.1006900Buy$90.54$9.46
49/30/2016MSTX$0.1016900Sell$0.11$91.44$100.79
59/30/2016BVX$4.920Buy$98.00$2.79
610/3/2016AMRS$0.59214Buy$2.37$0.42
710/3/2016BVX$5.3710Sell$0.00$53.70$54.12
810/3/2016NTNX$40.151Buy$40.15$13.97
910/3/2016AMRS$0.597321Buy$12.54$1.43
1010/3/2016AMRS$0.58592Buy$1.17$0.26
1110/4/2016NTNX$40.261Sell$0.00$40.26$40.51
1210/4/2016AMRS$0.582827Sell$0.00$15.74$56.25
1310/4/2016AUPH$3.4816Buy-$0.08$55.6$0.65
1410/6/2016AUPH$5.1516Sell$0.00$82.4$83.04
1510/6/2016BVX$5.2510Sell$0.00$52.5$135.54

<tbody>
</tbody>



Here are formulas -


H3 `=IF(((C3*D3)+F3)<>0,((C3*D3)+F3),"")`


I3 `=IF(E3="Buy",I2-H3,IF(E3="Sell",I2+H3-G3,IF(E3="Deposit",I2+H3,IF(E3="Withdrawn",I2-H3,IF(E3="Robin Hood",I2-G3,"")))))`


G4 `=IF(E4="Sell",(D4*C4*0.0000218)+(D4*0.000119),"")`



*Date, Adjustment, Stock/ETF, Price, Qty, Buy/Sell/Deposit/Withdrawn/RH, Adjustment* columns are all entered manually!


I am trying to achieve something like this in excel, where each row refers to the "Sells" in primary table and calculates profit/loss depending on how many shares sold that day and the price at which they were sold. It should look up the table to see if i have any outstanding shares bought in my account and still not sold and then calculate profit loss depending upon the avg. sell price and comparing it with avg. bought price -


DateStock/ETFProfit/Loss
9/30/2016MSTX$0.90
10/3/2016BVX$4.70
10/4/2016NTNX$0.11
10/4/2016AMRS-$0.34
10/6/2016AUPH$26.80
10/6/2016BVX$3.50

<tbody>
</tbody>



So if you observe above table, MSTX, NTNX and AUPH were straight buy and sells. But BVX I bought 20 and sold half for $4.70 profit and second half for $3.50 profit. With AMRS, I did multiple buys but only one sell, so i averaged the buy price for each share and then figured the profit.


How do I get this working in excel?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,216,099
Messages
6,128,822
Members
449,470
Latest member
Subhash Chand

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