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: :banghead:
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

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)
 

Watch MrExcel Video

Forum statistics

Threads
1,109,329
Messages
5,528,033
Members
409,799
Latest member
mlewan_ca

This Week's Hot Topics

Top