The SUMIF function
SUMIF adds up only the rows that match a condition: total sales for one region, spending in one category, or every order over £100.
It looks down one column for matches and adds the numbers from another column on the same rows.
=SUMIF(range, criteria, [sum_range])
Arguments
- range
- The cells to test against the condition.
- criteria
- The condition: a value like "North", a cell like F1, or a comparison like ">100".
- sum_rangeoptional
- The cells to add up. Leave it out to add up
rangeitself.
Try it
=SUMIF(A2:A6,"Food",B2:B6) in D2. Three rows say Food, so SUMIF adds £42.50 + £23.20 + £9.75.
D2
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Category | Amount | Food total | ||
| 2 | Food | £42.50 | £75.45 | ||
| 3 | Travel | £18.00 | |||
| 4 | Food | £23.20 | |||
| 5 | Bills | £60.00 | |||
| 6 | Food | £9.75 | |||
| 7 | |||||
| 8 |
Edit the formula in D2, or change the data, and press Enter.
More examples
| Formula | Result | What it does |
|---|---|---|
| =SUMIF(B2:B6,">20") | £125.70 | Adds every amount over £20. No sum_range is needed because the tested cells are the ones being added. |
| =SUMIF(A2:A6,"<>Food",B2:B6) | £78.00 | Everything except Food. |
| =SUMIF(A2:A6,"T*",B2:B6) | £18.00 | A wildcard: categories starting with T. |
Tips
- Put the condition in a cell (say F1) and use
=SUMIF(A2:A6,F1,B2:B6), so you can change it without editing the formula. - To combine a comparison with a cell, join them:
">"&F1. - Need two or more conditions? Use SUMIFS.
Common mistakes
- The total is 0.Check the criteria is spelt exactly as in the data and is in quote marks: "Food", not Food.
- The wrong numbers are added.
rangeandsum_rangeshould be the same size and start on the same row. - The header row is counted.Start the ranges on row 2, below the headings.
Practise SUMIF with instant feedback
Type real formulas into a working spreadsheet and get told straight away whether they work.