SUMIF with a range as Criteria

tdh222

New Member
Joined
Mar 25, 2002
Messages
3
I need to do a SUMIF, except instead of using a value as criteria, i need to compare to a range of cells, and if it matches any of those cells, then I want it to be summed. I'm guessing if this can be done it would be an array formula of some kind, but I've been unable to make it work so far.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I put the numbers in the criteria range in B1:B5 and the numbers ot be added in D1:D5.

The following array formula seems to work:
=SUM(SUMIF(D1:D5,$B$1:$B$5,D1:D5))
(Be sure to hit control-shirt-enter instead of enter upon input.)

You can use a 2-D range in place of either $b$1:$b$5 or D1:D5.
 
Upvote 0
Now, suppose I ALSO want $c$1:$c$5 to be equal to "c" in order for it to sum, how would I incorporate that into your suggested formula?
 
Upvote 0
On 2002-03-27 12:36, tdh222 wrote:
Now, suppose I ALSO want $c$1:$c$5 to be equal to "c" in order for it to sum, how would I incorporate that into your suggested formula?

What about:

=SUMPRODUCT((ISNUMBER(MATCH(crit-range,Range1,0)))*(Range2="c"),Range2)

where Range1 is tested whether it meets any of the conditions in crit-range, Range2 is tested whether it has "c", and Range2 is summed.
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,996
Members
448,935
Latest member
ijat

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