SUMIF
Add up the cells that meet a single condition.
Syntax
SUMIF(range, criteria, [sum_range]) | Argument | Required | Description |
|---|---|---|
range | Required | The cells tested against the condition. |
criteria | Required | The condition — "East", 100, ">400", or a wildcard pattern like "E*". |
sum_range | Optional | The cells to actually add. Omit it to sum the same cells you tested. |
Examples
Every example below was executed against VisiGrid engine 0.35.0 — not
transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.
| Formula | Result | Notes |
|---|---|---|
=SUMIF(B2:B4,"East",D2:D4) | 800 | Sales for the East rows — 500 plus 300. |
=SUMIF(D2:D4,">400") | 1200 | With sum_range omitted, the tested cells are the summed cells. |
=SUMIF(B2:B4,"E*",D2:D4) | 800 | Wildcards work in criteria. |
=SUMIF(A2:A2,"102",A2:A2) | 102 | Same criteria comparison as COUNTIF — a pattern language rather than a key. |
The argument order is backwards from SUMIFS
This is the most common mistake in the whole family, and it usually fails quietly:
=SUMIF(criteria_range, criteria, sum_range)
=SUMIFS(sum_range, criteria_range, criteria)
SUMIF puts the range being added last. SUMIFS puts
it first. Swapping them often produces a number rather than an error, so
nothing looks wrong.
The simplest defence is to use SUMIFS for everything, even with a single
condition. It costs one extra range reference, the argument order stops changing
depending on how many conditions you have, and adding a second condition later
doesn’t mean rewriting the formula backwards.
Omitting sum_range
When the cells you’re testing are the cells you want to add, leave sum_range
off:
=SUMIF(D2:D4, ">400")
That reads better than repeating the range, and there is no behavioural difference.
Excel compatibility
Matches Excel, including comparison operators and wildcards in criteria.