SUMPRODUCT with conditions as a range

dkubiak

Board Regular
Joined
May 17, 2004
Messages
137
Office Version
  1. 2013
Platform
  1. Windows
=SUMPRODUCT(--(AS2:AS20000=BA199),--(T2:T20000=BA191:BA197))

I want my second array to refer to a range of cells where the option within the range is OR. So, I want to count the values in AS where it matches BA199 and when T matches BA191 or BA192 or BA193...

Is this possible?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Try

=SUMPRODUCT(--(AS2:AS20000=BA199),--ISNUMBER(MATCH(T2:T20000,BA191:BA197,0)))
 
Upvote 0
That seems to be working great. Do you mind explaining what exactly is happening? I like to understand the functions as best as an amateur can.
 
Upvote 0
MATCH(T2:T20000,BA191:BA197,0)

is looking for a 'hit' for values in column T being found in BA191:BA197.

if a 'hit is found the MATCH returns a number so

ISNUMBER(MATCH(T2:T20000,BA191:BA197,0))

returns an array of False/True. The -- coerces that to an array of 0/1 that SUMPRODUCT can process.
 
Upvote 0
Or, your formula must have the same range, i.e.

=SUMPRODUCT(--(AS2:AS8=BA199),--(T2:T8=BA191:BA197))

Regards
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

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