nested sumif or sumif with two criteria

G

Guest

Say for example I have three columns; the first is a name column, second is
color and third is cost. I am trying to create a formula that will sum all
cells in the third column (cost) that matches the criteria of the name "Bob"
in column A AND "Red" in column B. I know I am close and I know I can use
the "*" somehow but I can't figure out the syntax. Any help is appreciated.
 
G

Guest

I did a search on my question before I posted and one of last years answers
was the exact same thing. I tried that formula but cannot seem to get it to
work. Thanks though.

Dan
 
P

Peter Aitken

dshigley said:
Say for example I have three columns; the first is a name column, second
is
color and third is cost. I am trying to create a formula that will sum
all
cells in the third column (cost) that matches the criteria of the name
"Bob"
in column A AND "Red" in column B. I know I am close and I know I can use
the "*" somehow but I can't figure out the syntax. Any help is
appreciated.

In my experience, if you want to sum based on 2 or more criteria you have to
use DSUM. SUMIF works with only 1 criterion.
 
G

Guest

Duke's equationm should have worked
put in a temporary column and use
=if(a2="Bob",1,2)
and copy down to row 100
See3 if all the "Bob" come up
to check if you might have extra spaces or something.
do likewise with "Red"
 
H

Harlan Grove

dshigley said:
I did a search on my question before I posted and one of last years answers
was the exact same thing. I tried that formula but cannot seem to get it to
work. Thanks though.
....

In what way does the formula not work? It does work if you've given correct
specs and have ensured your data range contains no leading or trailing
spaces in the entries in columns A and B and all entries are numbers rather
than text looking like numbers in column C.
....

Basic formula debugging. What do the formulas

=COUNTIF(A2:A100,"Bob")
=SUMPRODUCT(--(TRIM(A2:A100)="Bob"))
=SUMPRODUCT(--(TRIM(SUBSTITUTE(A2:A100,CHAR(168),""))="Bob"))

=COUNTIF(B2:B100,"Red")
=SUMPRODUCT(--(TRIM(B2:B100)="Red"))
=SUMPRODUCT(--(TRIM(SUBSTITUTE(B2:B100,CHAR(168),""))="Red"))

=SUM(C2:C100)
=SUMPRODUCT(--C2:C100)

return? If the first 3 and/or second 3 return different results, you have
either normal ASCII or nonbreaking HTML spaces in your columns A and/or B.
If the last two formulas return different results, some or all of your
column C values are text. The most robust formula would be

=SUMPRODUCT(--(TRIM(SUBSTITUTE(A2:A100,CHAR(168),""))="Bob"),
--(TRIM(SUBSTITUTE(B2:B100,CHAR(168),""))="Red"),--C2:C100)

However, the best approach would be to clean up the data in A2:C100.
 

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

Similar Threads

SUMIF with criteria "<>" & "=" 4
subtotal with sumif nested 1
Sumif criteria "equal" 3
Multiple SUMIF criteria 1
sumif 2
SUMIF function criteria options 4
SUMIF 2
CountIF() & SumIF() with multiple criteria 5

Top