the proper use of sumif

L

Lamb Chop

How can I sum B1:B33 if A1:A33 is in between 50 and 70 ?

I have tried this, but I only got 0

=SUMIF(A1:A33, "AND(>50, <70)", B1:B33)



Thanks
 
B

Bob Phillips

=SUMIF(A1:A33,">50")-SUMIF(A1:A33,">70")

this will include 70, use >= if you want to exclude it.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
L

Lamb Chop

Do you mean SUMIF can only have simple, ">", "<" and "=" comparison and all
the AND and OR functions won't work in SUMIF?

Thanks
 
B

Bob Phillips

Indeed I do.

You can use the technique I showed for simple conditions, or you can use

=SUMPRODUCT(--(A1:A33>50),--(A1:A33<=70),A1:A33)

which can be extended to much more complex formulae.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Top