sumproduct with multiple variables

S

sam

hi everyone,

here is my issue. i am using SUMPRODUCT for a couple of criteria and
returning the sum of another column. E.g.

A B 1
A C 2
B C 3
B E 4
C A 5
C D 5

=SUMPRODUCT((A1:A6="A")*(B1:B6="B"),C1:C6)+SUMPRODUCT((A1:A6="C")*(B1:B6="D"),C1:C6)
=> 1 + 5
=> 6

This all works fine but I was wondering if there was another option so i
would not have to use SUMPRODUCT multiple times. It is essential that A is
matched with B and that C is matched with D.

Thanks

Sam
 
T

T. Valko

Based on your sample data this portion returns 0:

=SUMPRODUCT((A1:A6="A")*(B1:B6="B"),C1:C6)

And this portion returns 5:

SUMPRODUCT((A1:A6="C")*(B1:B6="D"),C1:C6)

Combined, the result is 5.

So, I have no idea what this means:

=> 1 + 5
=> 6
 
J

Jacob Skaria

Try the below

=SUMPRODUCT(ISNUMBER(MATCH(A1:A6,{"A","C"},0))*
ISNUMBER(MATCH(B1:B6,{"B","D"},0)),C1:C6)

If this post helps click Yes
 
D

David Biddulph

=SUMPRODUCT((A1:A6&B1:B6="AB")+(A1:A6&B1:B6="CD"),C1:C6)
(assuming that each column has only a single character and thus that you
can't get AB or CD in one column and the other blank).
 
T

T. Valko

Ooops!

Yes it does. When I copied/pasted the data into a file I somehow missed row
1. My row 1 was:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top