FormulaCraft

How to use SUMIF with an OR condition in Excel and Google Sheets

Topic:SUMIF & SUMIFS
Excel & Google Sheets
=SUMIF($A$2:$A$5,"Apple",$B$2:$B$5)+SUMIF($A$2:$A$5,"Banana",$B$2:$B$5)

Verified example

Computed by a real spreadsheet engine on the sample data below.

ItemSales
Apple500
Banana300
Cherry450
Apple200

=SUMIF($A$2:$A$5,"Apple",$B$2:$B$5)+SUMIF($A$2:$A$5,"Banana",$B$2:$B$5)1000

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Write a SUMIF for the first criterion: =SUMIF($A$2:$A$100,"Apple",$B$2:$B$100).
  2. 2Add a second SUMIF for the next criterion: +SUMIF($A$2:$A$100,"Banana",$B$2:$B$100).
  3. 3For many criteria or dynamic lists, use SUMPRODUCT: =SUMPRODUCT(($A$2:$A$100="Apple")+($A$2:$A$100="Banana")>0,$B$2:$B$100) which is equivalent but more concise for 3+ conditions.

Tips

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

Can I use a list of criteria stored in a range instead of hardcoding each one?

Yes — use SUMPRODUCT and COUNTIF: =SUMPRODUCT((COUNTIF(E2:E5,A2:A100)>0)*B2:B100) sums column B where the column-A value appears anywhere in E2:E5.

Why is my SUMPRODUCT OR result too high?

Without the >0 wrapper, rows that match more than one criterion get counted twice. Use =SUMPRODUCT(((A:A="X")+(A:A="Y")>0)*B:B) to deduplicate.

How do I do SUMIFS with OR on one column and AND on another?

Add two SUMIFS together: =SUMIFS(C:C,A:A,"Apple",B:B,">100")+SUMIFS(C:C,A:A,"Banana",B:B,">100"). Each SUMIFS handles the AND, the + handles the OR.

What about counting (COUNTIF) with OR — same pattern?

Yes — =COUNTIF(A:A,"X")+COUNTIF(A:A,"Y") for 2-3 criteria, or =SUMPRODUCT(((A:A="X")+(A:A="Y")>0)*1) for many.

Does this work for OR on numbers (e.g. sum where value is 5 OR 10)?

Yes — drop the quotes: =SUMIF(A:A,5,B:B)+SUMIF(A:A,10,B:B). For ranges use comparison operators: =SUMIF(A:A,"<5",B:B)+SUMIF(A:A,">10",B:B).

Is there a single-formula OR alternative in newer Excel?

Excel 365 has SUMPRODUCT with explicit arrays, but no native SUMIF-OR. The cleanest modern option is FILTER + SUM: =SUM(FILTER(B:B,(A:A="X")+(A:A="Y"))) — only available in 365/Sheets.

More on SUMIF & SUMIFS

See all →

Formulas used

Related tasks

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: