How to use the SUMIF function
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Add up only the numbers whose row meets a condition — sales for one region, totals for one category.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =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. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 125 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
SUMIF — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to sum values by category (conditional sum) with SUMIF
- How to sum values where a checkbox is checked
- How to sum only positive (or only negative) numbers
- How to sum where another column is not blank
- How to sum with multiple criteria (SUMIFS)