4 Formulas in a 2x2 Table to Calculate the total Wins & total Losses for both Buys and Sales

thankyou

Board Regular
Joined
Aug 13, 2008
Messages
189
Hey my fellow celly nerds, I'm wondering if you can help out. I need 4 simple, but related formulas.

I uploaded a screenshot of the first page of my data here for you to quickly glance at first, if you would.

http://we.tl/1n6sJdBRot

It's just a wetransfer.com link, since there's no "browse" to local file option here. Thanks for looking at that image now.

OK, you'll notice there are 2 data columns. Column A5:A85 (not all data shown on the screenshot) is simply "B" for "buy" and "S" for "Sell". The gain or loss from each of those is reflected in the NEXT line, and in the "D" column (first result is always blank, so don't be alarmed there).

What I'm hoping for would be 4 Formulas to Calculate the total Wins & total Losses for both Buys and Sales.
You'll see further down that screenshot, that the 2x2 table is located at O15 thru Q17

So, basically it goes like this:

You see in A1 that the first trade is a "B"uy, that results in a 1.25 loss, ie -1.25.
The next trade in A2 is a "S"ell that results in a 0.5 loss, it -0.5
etc
etc

There are 2 instances (in this example) of "SL&R" which is just an internal label. So hopefully you're asking, "but there's no SL&R header in your 2x2 table. How do you want us to treat those, as B or S? The answer is this: It's whatever the cell immediately above it is.

So, if A11 reads "SL&R", then because the cell above it is a "Sell" trade, you'll treat the SL&R trade result (-1.5 found in D12) as a "S"ell. It just so happens both instances in this screenshot I've shared are "S". We don't just call them sales because they represent additional information that's important internally.

In summary, I'm simply needing 4 formulas that will go into P16, Q16, P17, Q17.

Thanks and if you have any questions I'll do my best to answer them.

Kind regards.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hello
In O16--
=SUM(IF(LEFT($Q$5:$Q$85,2)="B+",$D$5:$D$85,0))
In O17--
=SUM(IF(LEFT($Q$5:$Q$85,2)="S+",$D$5:$D$85,0))
In P16--
=SUBSTITUTE(SUM(IF(LEFT($Q$5:$Q$85,2)="B-",$D$5:$D$85,0)),"-","")+0
In P17--
=SUBSTITUTE(SUM(IF(LEFT($Q$5:$Q$85,2)="S-",$D$5:$D$85,0)),"-","")+0

PLEASE NOTE THAT THESE ARE ARRAY FORMULAS-------
To make them work first copy them from here one by one and instead of just pasting ......first select the cell press F2 cursor will appear then paste and finally press Ctrl+Shift+Delete instead of just Enter.....

Now you must be wandering why is Q column used in my formula.....so I have used column Q for formula purpose....you can use any other column and make changes accordingly in these formula..
In Q5 enter the following formula and copy it down till Q85----

=IF(A5="","",IF(IFERROR(SEARCH("-",IF(A5="SL&R",A4&D5,A5&D5)),"Q")=2,IF(A5="SL&R",A4&D5,A5&D5),LEFT(IF(A5="SL&R",A4&D5,A5&D5))&"+"&RIGHT(IF(A5="SL&R",A4&D5,A5&D5))))

Hope it helps.....
Regards
Sourabh Gupta
 
Upvote 0
Awesome Sourabh! The numbers seem to check out. Thanks for your efforts and time. Much appreciated sir!
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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