CSE-function version of SumIf

jberg123

New Member
Joined
Feb 24, 2011
Messages
45
In column A: week numbers
In cell U4: a week number
In column I: if the trade was a B (buy) or S (sell)
In cell V3: the letter B

the CSE-formula {=SUM(IF($A$2:$A$111=$U4,IF($I$2:$I$111=V$3,1,0),0))} will give the number of B (buys) in a given week (specified by week number).

Using this I create a table with the number of buy order during a range of different weeks.

Now, instead, I would like to sum the total number shares bought during each week. The volume of bought shares for each order is in column J.

How can I do this?

My current CSE-function is a bit like a 2-condition CountIf. What I need to turn it into is a 2-condition SumIf.

Any ideas?

Many thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
In column A: week numbers
In cell U4: a week number
In column I: if the trade was a B (buy) or S (sell)
In cell V3: the letter B

the CSE-formula {=SUM(IF($A$2:$A$111=$U4,IF($I$2:$I$111=V$3,1,0),0))} will give the number of B (buys) in a given week (specified by week number).

Using this I create a table with the number of buy order during a range of different weeks.

Now, instead, I would like to sum the total number shares bought during each week. The volume of bought shares for each order is in column J.

How can I do this?

My current CSE-function is a bit like a 2-condition CountIf. What I need to turn it into is a 2-condition SumIf.

Any ideas?

Many thanks
No need for a CSE formula.

Try one of these...

This one will work in any version of Excel:

=SUMPRODUCT(--(A2:A111=U4),--(I2:I111=V3),J2:J111)

This one will work in excel 2007 or later:

=SUMIFS(J2:J111,A2:A111,U4,I2:I111,V3)
 
Upvote 0
In column A: week numbers
In cell U4: a week number
In column I: if the trade was a B (buy) or S (sell)
In cell V3: the letter B

the CSE-formula {=SUM(IF($A$2:$A$111=$U4,IF($I$2:$I$111=V$3,1,0),0))} will give the number of B (buys) in a given week (specified by week number).

Using this I create a table with the number of buy order during a range of different weeks.

Now, instead, I would like to sum the total number shares bought during each week. The volume of bought shares for each order is in column J.

How can I do this?

My current CSE-function is a bit like a 2-condition CountIf. What I need to turn it into is a 2-condition SumIf.

Any ideas?

Many thanks

The formula would become something like:

Control+shift+enter...
Code:
=SUM(
    IF($A$2:$A$111=$U4,
    IF($I$2:$I$111=V$3,
      $J$2:$J$111)))

It's a good idea to switch to COUNTIFS and SUMIFS if you are on Excel 2007 or later.
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,792
Members
452,942
Latest member
VijayNewtoExcel

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