SUM IF and two variables

G

Guest

I have tried...without success.

A B C D
dog 1 brown 2
cat 1 brown
dog 2 black 4
cat 3 blue

For example: I need a formula that says if column D has a value in it AND
column A = "dog", then sum column B. I have tried versions of the SUMPRODUCT
function but cannot solve it. The problem is that column D cells contain a
formula, I think. Any help is greatly appreciated.
 
G

Guest

If the formula in D is returning an empty string (""), then this will work

=SUMPRODUCT(--(A32:A35="dog"),--(LEN(D32:D35)>0),B32:B35)

If it's returning a 0 that is formatted to not show then

=SUMPRODUCT(--(A1:A5="dog"),--(D1:D5>0),B1:B5)
 
G

Guest

Thanks, Duke - that worked!

Duke Carey said:
If the formula in D is returning an empty string (""), then this will work

=SUMPRODUCT(--(A32:A35="dog"),--(LEN(D32:D35)>0),B32:B35)

If it's returning a 0 that is formatted to not show then

=SUMPRODUCT(--(A1:A5="dog"),--(D1:D5>0),B1:B5)
 

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