← All how-to recipes

How to SUMIF with OR criteria (this value or that one)

✓ Verified in LibreOffice 25.8.7.3

Sum rows matching ANY of several values — East or West, two product codes, multiple statuses.

The formula

AppFormulaNotes
Excel=SUM(SUMIF(A2:A6,{"East","West"},B2:B6))The array constant makes SUMIF return one subtotal per value; SUM adds them.
Google Sheets=SUM(SUMIF(A2:A6,{"East","West"},B2:B6))Identical (Sheets array constants use the same braces).
LibreOffice Calc=SUM(SUMIF(A2:A6,{"East","West"},B2:B6))Identical.

How it works

SUMIF against the array constant {"East","West"} evaluates once per value — producing {110, 50} — and the outer SUM collapses them: 160. This is safe for OR-of-EXACT-values because one row can't match two different values, so nothing double-counts (unlike adding overlapping condition SUMIFs). For OR across different COLUMNS' conditions, where overlap is possible, use the SUMPRODUCT pattern from the sumif-vs-sumproduct comparison instead.

Verified, not just documented

We ran =SUM(SUMIF(A2:A6,{"East","West"},B2:B6)) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 160 — exactly the expected result. Every formula here is confirmed by actually executing it.