# SUMIF in Excel: Adding Up Only the Rows That Match

What the range and sum_range arguments each do, how criteria like ">1000" and "A*" are evaluated, why SUMIFS puts the sum range first, and how to diagnose a total that comes back zero.

> excel formulas · sumif · conditional aggregation · About 6 min · Nov 3

## Key points

1. SUMIF adds a column only for the rows where a separate column meets a condition, and the answer updates itself when the data changes.
2. Its three arguments are range (tested), criteria (the rule), and sum_range (added); if sum_range is left out, the tested range is also the one summed.
3. The two ranges are aligned by row position, not by size: Excel takes only the top-left cell of sum_range and extends a block the same shape as range, so a one-row offset silently produces a wrong total.
4. Text criteria and any operator need double quotes (">1000"), a cell reference goes unquoted, and a variable threshold is built with & — ">"&F2.
5. Wildcards * (any run of characters) and ? (one character) give partial matches inside a criteria.
6. SUMIFS handles two or more conditions with AND, but the sum range moves to the first argument, which is the most common copy-paste error.
7. A total of 0 usually means the amounts are stored as text, the criteria is malformed or quoted, or labels differ by invisible spaces — check with plain SUM before rewriting the formula.
8. SUMIF cannot express OR, ignores new rows added below its fixed ranges, and mishandles criteria strings over 255 characters.

---

`SUM` answers "how much in total". Most real questions are narrower than that: how much did the North region sell, how much came from orders over 1,000, how much came from Ada in the North. You can answer them by filtering, copying the visible rows somewhere else, and summing those — but the answer goes stale the moment the data changes, and the sum lives in the wrong place.

`SUMIF` answers the same question with one formula that stays live. You name a column to test, a condition to test it against, and a column to add. By the end of this tutorial you will have written one, seen exactly how Excel pairs up the two columns behind the scenes, learned how criteria like `">1000"` and `"A*"` are read, and fixed a total that comes back as **0** instead of the number you expected.

**What you need:** any version of Excel, including Excel for the web. You should already know that `B2:B9` is a range and that formulas point at cells by address — if that is shaky, read [cells, formulas and cell references](https://eulore.ai/articles/how-to-use-excel-5a9f3a0a) first.

Type this table into a blank sheet, starting in `A1`:

| Order | Region | Rep | Amount |
| --- | --- | --- | --- |
| 1001 | North | Ada | 1200 |
| 1002 | South | Ben | 800 |
| 1003 | North | Cara | 1500 |
| 1004 | East | Dev | 400 |
| 1005 | North | Ada | 950 |
| 1006 | South | Cara | 2000 |
| 1007 | East | Ben | 300 |
| 1008 | North | Dev | 1100 |

The order column is decoration; the other three span rows 2 to 9.

## Step 1: How to use SUMIF in Excel

In `F1` type `North`, and in `G1` enter:

```
=SUMIF(B2:B9,"North",D2:D9)
```

`G1` shows **4750** — 1200 + 1500 + 950 + 1100. The rows from South and East contribute nothing, but they are never removed; they are simply not added.

The formula has three arguments:

- **range** — the cells to test: `B2:B9`, the Region column.
- **criteria** — what a cell in that range must satisfy: `"North"`.
- **sum_range** — the cells to add when a test passes: `D2:D9`, the Amount column.

Excel walks down `B2:B9` one cell at a time. Each time the cell says North, it takes the corresponding cell in `D2:D9` and adds it. When the third argument is left out, the tested range is also the one that gets added — which is why `=SUMIF(D2:D9,">1000")` returns **5800**: it tests the amounts and adds the ones over 1000. That shorthand is correct only when the condition and the numbers live in the same column.

![A SUMIF formula with its three arguments labelled: the range being tested, the criteria, and the sum_range being added](https://exceljet.net/functions/sumif-function/images/exceljet_sumif_function_hu_c3f98f3758e0cc1f.webp)

## Step 2: The two ranges are paired by position, not by size

The two ranges cannot be matched by value — one holds text, the other numbers. What actually ties them together is row position: the first cell of `range` pairs with the first cell of `sum_range`, the second with the second, and so on.

That has a consequence worth remembering, because it explains a whole family of silently wrong totals. Excel reads only the **top-left cell** of `sum_range` and then grabs a block the same size and shape as `range` [1]. So if `range` is 8 rows tall, the summed block is 8 rows tall starting wherever you pointed it, even if you typed something different. Pointing at `D2:D9` and at `D2:D100` gives the same answer here.

The danger is the offset. Write `=SUMIF(B2:B9,"North",D3:D9)` and you have not summed D3:D9. Excel starts at D3 and extends downward for 8 rows, taking in D3:D10, then pairs those cells with B2:B9 one row too low. The formula still returns a number, and it is quietly wrong. Both ranges must start on the same row.

## Step 3: How criteria are actually evaluated

The criteria argument is the part people get stuck on, because it does not hold a value — it holds a rule. Excel's rules:

- **Text must be in double quotes.** `"North"` works, bare `North` gives `#NAME?`.
- **Numbers do not need quotes.** `1000` is fine, though `"1000"` also works.
- **Operators must live inside the quotes.** Greater than 1000 is `">1000"` — a single string, because the operator and the number are one rule. The whole criteria argument is case-insensitive, so `"north"` matches North too.
- **A cell reference is passed bare.** If `F1` holds `North`, the criteria is `F1`, with no quotes. Typing `"F1"` compares every region against the literal four characters F–1, matches nothing, and returns `0`.
- **To combine an operator with a cell reference, glue them with `&`.** Put `1000` in `F2` and write `=SUMIF(D2:D9,">"&F2)` to get a threshold you can change without editing the formula.

Wildcards turn criteria into partial matches. `*` stands for any run of characters and `?` for exactly one, so `"A*"` matches any rep whose name starts with A, `"*a"` matches any name ending in a, and `"*ar*"` matches any name containing ar [4]. `=SUMIF(C2:C9,"A*",D2:D9)` returns **2150** (Ada's two orders), while `=SUMIF(C2:C9,"*ar*",D2:D9)` returns **3500** (Cara's).

## Step 4: Adding a second condition with SUMIFS

`SUMIF` tests exactly one thing. For two conditions at once you use `SUMIFS`, which takes pairs of range-and-criteria:

```
=SUMIFS(D2:D9,B2:B9,"North",C2:C9,"Dev")
```

That returns **1100** — the single order that is both North and Dev.

Notice what moved: **the sum range is now the first argument**, and the tested ranges follow in pairs [2]. This is the single most common SUMIF mistake, because the two functions look almost identical and the arguments are in a different order. If you copy a `SUMIF` and add a condition, you must move the amount column to the front.

`SUMIFS` combines conditions with AND: a row must satisfy every pair. There is no argument for OR. To add rows that are in either of two regions, add two `SUMIF`s together — `=SUMIF(B2:B9,"North",D2:D9)+SUMIF(B2:B9,"East",D2:D9)`.

## Why your SUMIF returns 0

This is the most common search that follows a SUMIF tutorial, and there are only a few causes worth checking, in this order:

1. **The numbers are stored as text.** If the Amount column was pasted from another system, the values may be left-aligned with a green warning triangle. `SUMIF` adds numbers and skips text, so it returns 0. Diagnostic: put plain `=SUM(D2:D9)` next to it. If that is also 0, the problem is the data, not the criteria — convert the column to numbers.
2. **The criteria points at the wrong cell.** A quoted cell reference (`"F2"` instead of `F2`) compares against the literal text F2, and a reference to an empty cell turns `">"&F2` into a bare `">"`, which matches nothing.
3. **The labels do not match exactly.** `SUMIF` does not trim spaces, so a Region stored as `"North "` with a trailing space will not match `"North"`. This is the same invisible-difference problem that makes duplicate rows survive a cleanup pass.
4. **The sum range is offset.** If steps 1–3 are clean, check that `range` and `sum_range` start on the same row, per Step 2.

The order matters: a total of 0 almost always means *no row matched, or the matching rows held no numbers*. A total that is merely too small or too large usually means a misalignment.

## The same pattern with COUNTIF

Once the criteria grammar is familiar, the counting version costs nothing extra. `=COUNTIF(B2:B9,"North")` returns **4**, the number of North rows, and `=COUNTIFS(B2:B9,"North",C2:C9,"Ada")` returns **2**. `COUNTIF` has only two arguments — range and criteria — because there is nothing to add. Everything from Step 3 about quotes, operators, cell references and wildcards applies unchanged [5].

Want rows *selected* rather than summed? That is what [the IF function](https://eulore.ai/articles/if-function-excel-b7ffd56e) is for: same kind of test, but it returns one of two results instead of adding a column.

## What SUMIF cannot do

Two limits are worth knowing so you do not chase them. `SUMIF` gives wrong results when the criteria has to match a text string longer than 255 characters, or the literal string `#VALUE!` [1] — rare, but real when you match against pasted comment fields. And because `SUMIF` recalculates against fixed ranges, a formula pointed at `B2:B9` will not see row 10 when you add it; if the data grows, either extend the range or convert it to an Excel Table so the reference grows with it.

## Mind map

```mermaid
flowchart LR
  Q["Question: how much, but only for some rows"] --> S["SUMIF(range, criteria, sum_range)"]
  S --> R["range = tested column"]
  S --> C["criteria = rule, not value"]
  S --> SR["sum_range = added column"]
  SR --> P["paired by row position, top-left cell sets the block"]
  C --> Q1["quotes for text and operators: &gt;1000"]
  C --> Q2["bare cell reference, &amp; for variable threshold"]
  C --> W["wildcards * and ?"]
  S --> Z["total of 0: text numbers, bad criteria, stray spaces, offset"]
  S --> M["two conditions: SUMIFS, sum range first"]
  S --> L["limits: no OR, fixed ranges, 255-character criteria"]
  M --> C2["COUNTIF / COUNTIFS count instead of adding"]
```

## Glossary

- range and sum_range：SUMIF's tested column and its added column, paired cell by cell down the rows rather than matched by content.
- criteria：a rule rather than a value — text and operators go inside quotes, cell references are passed bare, and & glues an operator to a cell.
- wildcard：`*` and `?` placeholders inside a criteria that let one rule match many spellings.
- SUMIFS：the multi-condition version of SUMIF that requires every pair to be true and takes the sum range as its first argument.

## Sources

1. [Microsoft Support: SUMIF function — arguments, the top-left rule for sum_range, wildcards, and the 255-character limitation](https://support.microsoft.com/en-us/excel/functions/sumif-function)
2. [Microsoft Support: SUMIFS function — range/criteria pairs and the different argument order](https://support.microsoft.com/en-us/excel/functions/sumifs-function)
3. [Exceljet: SUMIF function — annotated formula image and criteria syntax table](https://exceljet.net/functions/sumif-function)
4. [Exceljet: Sum if cells contain specific text — wildcard criteria patterns for starts-with, ends-with and contains](https://exceljet.net/formulas/sum-if-cells-contain-specific-text)
5. [Ablebits: How to use SUMIF in Excel with formula examples — sum_range sizing behaviour and criteria gotchas](https://www.ablebits.com/office-addins-blog/excel-sumif-function-formula-examples/)

---

Original article: https://eulore.ai/articles/sumif-19e87f10

> **Eulore** · Start small. Go deep.
>
> Eulore is an AI learning tool built around connected articles, each a 5–10 minute read. Ask questions as you go and help shape what comes next. That’s how this article was created.
>
> Start your own series → https://eulore.ai
