SUMIF with "OR" criteria

S

SwtHapa8

Hello, I'm having an issue with an IF-THEN formula. In my situation, I'm
trying to say," If A1:A5
= CA or DE or NJ or NY or PA or WI, then sum B1:B5"

Can anyone help?

Column A Column B
CA 2
NJ 3
DE 4
SC 5
TN 6
 
S

smartin

SwtHapa8 said:
Hello, I'm having an issue with an IF-THEN formula. In my situation, I'm
trying to say," If A1:A5
= CA or DE or NJ or NY or PA or WI, then sum B1:B5"

Can anyone help?

Column A Column B
CA 2
NJ 3
DE 4
SC 5
TN 6

Here are two functionally equivalent ways to do it:

=SUMPRODUCT((A1:A5="CA")+(A1:A5="NJ")+...,B1:B5)

(array* formula):
=SUM(IF((A1:A5="CA")+(A1:A5="NJ")+...,B1:B5))

Insert more (A1:A5="xx")+ conditions as needed.

*Commit the array formula by pressing Ctrl+Shift+Enter; do not just
press Enter or Tab.
 

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