SUMIF function.... possible to pass 2 different "criter

rca

Board Regular
Joined
Mar 1, 2005
Messages
182
Hi Everyone,

Please help!!

Is it possible to pass two (2) separate "criteria" (the second argument) in the SUMIF function?

For example, I have the following in my worksheet:

- in B17:B28, I have some data
- in E17:C28, I have some other data
- in J17:D28, I have the numbers to be summed up


- I would like to use the SUMIF function to SUM up the range J17:J28 based on the criteria in range B:17:B28 and E17:E28. More to the point, the function would sum only if the criteria in B17:B28 and E17:E28 matched.

note: this gets tricky because you also have to pass these criteria through the "range" argument in the SUMIF function

Is this even possible?

If it's not possible using the SUMIF formula directly, can someone please suggest some VBA code that might do the trick??

Thank you!
Rachel :biggrin: :oops:
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

TheNoocH

Well-known Member
Joined
Oct 6, 2004
Messages
3,482
see if this works


=SUMPRODUCT(--(B17:B28=E17:E28),J17:J28)

if not post some of your data and your expected result



here's a quick example
Book1
ABCD
1aa10
2bb20
3cd30
4ee40
5
6
770
Sheet1
 

rca

Board Regular
Joined
Mar 1, 2005
Messages
182
Hi Nooch!

This works really well!

Thanks for your help,
Rachel (y)
 

Forum statistics

Threads
1,141,139
Messages
5,704,503
Members
421,353
Latest member
jekoxien15

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
Top