SUMIF and AND/OR/NOT

J

JenniferCHW

I am looking to add an AND, OR, or NOT to my formula or a combination of these
Right now I have
Col A Col b Col C
sumif(column A, "XXXX", column c) (column A meets X criteria then sum
col. c)
I want the formula to be if column a meets x criteria and the value in
column b is either Y or Z but not e, f, g then sum col c.
If tried a bunch of different options with AND and OR but can't seem to put
it together in the right order.
Can you provide some guidance?
Thanks.
 
J

JenniferCHW

I tried both responses and can't seem to get this to work. Let me be a bit
more specific with a short example.

Col A Col B Col C
Apple West 5
Orange South 7
Orange East 9
Orange West 4

I am looking for oranges in the west or east only. The answer is 13.
 
T

T. Valko

E1 = orange
F1 = west
G1 = east

=SUMPRODUCT(--(A1:A4=E1),--(ISNUMBER(MATCH(B1:B4,F1:G1,0))),C1:C4)

Result = 13
 
Y

-yuval

A question very similar but a little different

Col B = name (text field)
Col C = Last name (text field)
Col D = Expences (number)

I would like to SUM to A1 total expences of a person answering True on Col B
& Col C

Name will apear more then once on A & B

Thanks a milion
 
T

T. Valko

Try this:

=SUMPRODUCT(--(B1:B10="John"),--(C1:C10="Smith"),D1:D10)

Better to use cells to hold the criteria:

A2 = some first name = John
A3 = some last name = Smith

=SUMPRODUCT(--(B1:B10=A2),--(C1:C10=A3),D1:D10)
 
J

JenniferCHW

But what is F1:g1 supposed to be set to?

T. Valko said:
Each of these expressions will return an array of TRUE or FALSE:

(A1:A4=E1)
(ISNUMBER(MATCH(B1:B4,F1:G1,0)))

The double unary minus "--" coerces those logical values to 1 for TRUE and 0
for FALSE.

Then all 3 arrays are multiplied together:

0*1*5=0
1*0*7=0
1*1*9=9
1*1*4=4

Then summed for the final result:

=SUMPRODUCT({0;0;9;4}) = 13

For more info see:

http://xldynamic.com/source/xld.SUMPRODUCT.html
http://mcgimpsey.com/excel/formulae/doubleneg.html
 

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