← All how-to recipes

How to use the SUMIF function

✓ Verified in LibreOffice 25.8.7.3

Add up only the numbers whose row meets a condition — sales for one region, totals for one category.

The formula

AppFormulaNotes
Excel=SUMIF(A2:A10,"East",B2:B10)SUMIF(range to test, criteria, range to add). Omit the last range to sum the tested range itself.
Google Sheets=SUMIF(A2:A10,"East",B2:B10)Identical.
LibreOffice Calc=SUMIF(A2:A10,"East",B2:B10)Identical.

How it works

SUMIF has three parts: the range to check (A2:A4, the regions), the criteria to match ("East"), and the range to add up (B2:B4, the amounts). It adds the amounts only on rows where the region is East: 100 + 25 = 125. The criteria can be a number, text, a comparison in quotes (">100"), or a wildcard ("East*"). If you leave off the third range, SUMIF sums the tested range itself — handy for =SUMIF(A2:A10,">0") to total just the positives. For more than one condition, step up to SUMIFS (note its argument order flips: sum range comes FIRST there).

Verified, not just documented

We ran =SUMIF(A2:A4,"East",B2:B4) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 125 — exactly the expected result. Every formula here is confirmed by actually executing it.