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

#### rca

##### Board Regular
Hi Everyone,

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!

### 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
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
Hi Nooch!

This works really well!

Thanks for your help,
Rachel

Replies
17
Views
275
Replies
2
Views
46
Replies
4
Views
132
Replies
4
Views
114
Replies
0
Views
136