View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
smartin smartin is offline
external usenet poster
 
Posts: 915
Default SUMIF with "OR" criteria

SwtHapa8 wrote:
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.