ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   SUMIF with "OR" criteria (https://www.excelbanter.com/excel-worksheet-functions/240718-sumif-criteria.html)

SwtHapa8

SUMIF with "OR" criteria
 
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


smartin

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.

T. Valko

SUMIF with "OR" criteria
 
see your other post

--
Biff
Microsoft Excel MVP


"SwtHapa8" wrote in message
...
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





All times are GMT +1. The time now is 07:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com