Excel SUMIF examples: text, dates, wildcards, and what to do when it isn't working
One function, three arguments and a handful of traps. On a charity shop's real sheet you'll see every kind of criteria at work, and you can try SUMIF yourself right away.
Christophe, founder of Lurndo
· 11 min read
SUMIF adds up the numbers from the rows that meet one condition. You give it three arguments: the range to test, the criteria and the sum range, as in =SUMIF(B2:B16,"Clothing",C2:C16). Text and criteria with an operator go in quotation marks, such as ">10", and you join a cell on with &. If the formula returns 0, check for spaces, numbers stored as text and the order of the arguments.

What does SUMIF do in Excel?
SUMIF adds up the numbers from the rows that meet one condition. Where SUM adds up everything, SUMIF first checks whether a row fits: is it clothing, does it cost more than £10, did Grace sell it? =SUMIF(B2:B16,"Clothing",C2:C16) looks for Clothing in column B and adds up the prices in column C for those rows. In a Dutch copy of Excel, the same function is called SOM.ALS.
Every example below works on the same sheet: a week of sales at the Second Chance charity shop in Gloucester, the fourth client in our Excel course. If you'd rather learn the function step by step, with explanations on the sheet itself, follow the lesson on SUMIF. This article is the reference that goes with it: an example for every kind of criteria, and what to do when the answer looks wrong.
How do you write a SUMIF formula?
SUMIF takes three arguments, and you can leave the last one out (Microsoft). The first says where Excel tests, the second what it tests for, and the third what it adds up. Here's the syntax as Microsoft's help writes it, with square brackets around the optional argument:
=SUMIF(range,criteria,[sum_range])| Argument | What it is | Required? |
|---|---|---|
| range | The cells you test the condition in, such as the categories in B2:B16 | Yes |
| criteria | The condition: a number, text, a comparison such as ">10", a cell or a function | Yes |
| sum_range | The cells you add up, such as the prices in C2:C16 | No: without it, SUMIF adds up the range itself |
Most English-language help writes SUMIF with commas, but that comes from your settings, not from Excel. Microsoft says the separator depends on your operating system's locale and your Excel settings, and that the comma and the semicolon are the most common (Microsoft). Where the comma is the decimal mark, as in much of mainland Europe, you'll see semicolons instead.
Leave the sum range out and SUMIF adds up the cells it tests. That's handy when you test the numbers themselves: =SUMIF(C2:C16,">10") adds up every price over £10. When you test text, though, you need the third argument. Without it, the function adds up a column of words, and you get 0.
How do you sum by category with SUMIF?
Yasmina, who runs the volunteers at Second Chance, wants to know what the clothing brought in this week. Here's the whole sheet, all fifteen sales. At the till, the volunteers note the item, its category, the price, the day and who sold it, so Yasmina can work out afterwards what each kind of item brought in.
| Row | A: Item | B: Category | C: Price (£) | D: Day | E: Volunteer |
|---|---|---|---|---|---|
| 2 | Dress green | Clothing | 12 | Mon | Sophie |
| 3 | Book fiction | Books | 2 | Mon | Omar |
| 4 | Lamp | Household | 8 | Tue | Sophie |
| 5 | T-shirt S | Clothing | 3 | Tue | Grace |
| 6 | Dressing gown | Clothing | 6 | Wed | Omar |
| 7 | Puzzle | Toys | 4 | Wed | Grace |
| 8 | Book cooking | Books | 3 | Thu | Sophie |
| 9 | Radio | Electrical | 15 | Thu | Omar |
| 10 | T-shirt XL | Clothing | 4 | Fri | Sophie |
| 11 | Dress black | Clothing | 18 | Fri | Grace |
| 12 | What? Game | Toys | 5 | Sat | Omar |
| 13 | Vase | Household | 7 | Sat | Grace |
| 14 | T-shirt M | Clothing | 3 | Sat | Sophie |
| 15 | Bookend | Household | 9 | Sat | Omar |
| 16 | Kids' bike | Toys | 35 | Sat | Grace |
=SUMIF(B2:B16,"Clothing",C2:C16)The formula returns £46. SUMIF works down column B and finds Clothing in six rows: Dress green, T-shirt S, Dressing gown, T-shirt XL, Dress black and T-shirt M. For each of those rows it takes the price in the same position in column C: 12 + 3 + 6 + 4 + 18 + 3 = 46. That's why the range and the sum range have to be the same size and start on the same row.
Now try it yourself, with a different condition. The exercise runs on Second Chance's real sheet, and you type the formula just as you would in Excel, with commas or semicolons. First work out which column you test in, and which column you add up.
Try it: what did Omar take?
How much did Omar take at the till this week? Work it out in I2 with SUMIF.
| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Item | Category | Price | Day | Volunteer | Limit | ||||
| 2 | Dress green | Clothing | £12.00 | Mon | Sophie | £10.00 | ||||
| 3 | Book fiction | Books | £2.00 | Mon | Omar | |||||
| 4 | Lamp | Household | £8.00 | Tue | Sophie | |||||
| 5 | T-shirt S | Clothing | £3.00 | Tue | Grace | |||||
| 6 | Dressing gown | Clothing | £6.00 | Wed | Omar | |||||
| 7 | Puzzle | Toys | £4.00 | Wed | Grace | |||||
| 8 | Book cooking | Books | £3.00 | Thu | Sophie | |||||
| 9 | Radio | Electrical | £15.00 | Thu | Omar | |||||
| 10 | T-shirt XL | Clothing | £4.00 | Fri | Sophie | |||||
| 11 | Dress black | Clothing | £18.00 | Fri | Grace | |||||
| 12 | What? Game | Toys | £5.00 | Sat | Omar | |||||
| 13 | Vase | Household | £7.00 | Sat | Grace | |||||
| 14 | T-shirt M | Clothing | £3.00 | Sat | Sophie | |||||
| 15 | Bookend | Household | £9.00 | Sat | Omar | |||||
| 16 | Kids' bike | Toys | £35.00 | Sat | Grace | |||||
| 17 |
Your formula ran in your own browser, on a real calculation engine. We check the result, not the letters of your formula: write "omar" in lower case and that's just as good. Then we run your formula again on a hidden version of the sheet with different prices. Work the amount out by hand and type it in, and it gets caught there.
How do you use greater than and less than in SUMIF?
Put the operator at the front of the criteria, inside the quotation marks: ">10", not >"10". Microsoft says any criteria with text or with logical or mathematical symbols must go in double quotation marks (Microsoft). Most of these examples test the prices and add them up too, so the sum range can go.
| Operator | Means | Example | Result |
|---|---|---|---|
> | greater than | =SUMIF(C2:C16,">15") | £53 |
>= | greater than or equal to | =SUMIF(C2:C16,">=15") | £68 |
< | less than | =SUMIF(C2:C16,"<5") | £19 |
<= | less than or equal to | =SUMIF(C2:C16,"<=5") | £24 |
<> | not equal to | =SUMIF(B2:B16,"<>Clothing",C2:C16) | £88 |
= | equal to | =SUMIF(C2:C16,3) | £9 |
Watch the boundaries. The £15 radio counts with ">=15" but not with ">15", and that's the whole gap between 68 and 53. The same goes for the £5 game with "<5" and "<=5". With a plain number you can drop the equals sign and the quotation marks: 3, "3" and "=3" all return £9, for the three items at £3.
How do you use a cell reference in SUMIF criteria?
Join the operator and the cell with &, as in =SUMIF(C2:C16,">"&G2). The operator goes in quotation marks, the reference doesn't. With the £10 limit in G2 that returns £80, and when Yasmina changes the limit, the formula follows straight away. Microsoft uses the same pattern in its own examples (Microsoft).
The classic mistake is ">G2". Inside quotation marks, G2 is just text, so Excel looks for prices greater than the letters G2. There aren't any, so you get 0, with no error to warn you. Try it yourself below. We also check your formula on a hidden version of the sheet with a different limit, so a typed-in 10 stands out at once.
Try it: everything over the limit
What did the items that cost more than the limit in G2 bring in together? Work it out in I2, with a reference to G2.
| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Item | Category | Price | Day | Volunteer | Limit | ||||
| 2 | Dress green | Clothing | £12.00 | Mon | Sophie | £10.00 | ||||
| 3 | Book fiction | Books | £2.00 | Mon | Omar | |||||
| 4 | Lamp | Household | £8.00 | Tue | Sophie | |||||
| 5 | T-shirt S | Clothing | £3.00 | Tue | Grace | |||||
| 6 | Dressing gown | Clothing | £6.00 | Wed | Omar | |||||
| 7 | Puzzle | Toys | £4.00 | Wed | Grace | |||||
| 8 | Book cooking | Books | £3.00 | Thu | Sophie | |||||
| 9 | Radio | Electrical | £15.00 | Thu | Omar | |||||
| 10 | T-shirt XL | Clothing | £4.00 | Fri | Sophie | |||||
| 11 | Dress black | Clothing | £18.00 | Fri | Grace | |||||
| 12 | What? Game | Toys | £5.00 | Sat | Omar | |||||
| 13 | Vase | Household | £7.00 | Sat | Grace | |||||
| 14 | T-shirt M | Clothing | £3.00 | Sat | Sophie | |||||
| 15 | Bookend | Household | £9.00 | Sat | Omar | |||||
| 16 | Kids' bike | Toys | £35.00 | Sat | Grace | |||||
| 17 |
How does SUMIF work with text and wildcards?
For part of a text, use wildcards: * stands for any number of characters, including none, and ? for exactly one. To find a real question mark or asterisk, put a tilde ~ in front of it (Microsoft). The item names in column A are made for it:
=SUMIF(A2:A16,"Dress*",C2:C16)| Criteria on column A | Matches | Result |
|---|---|---|
"Dress*" | Dress green, Dressing gown, Dress black | £36 |
"Dress *" | Dress green, Dress black | £30 |
"T-shirt ?" | T-shirt S and T-shirt M, not XL | £6 |
"*book*" | Book fiction, Book cooking, Bookend | £14 |
"What~?*" | What? Game | £5 |
Mind the space in "Dress *": it's part of the criteria, so the dressing gown drops out. Empty cells have criteria too. "" adds up where a cell is empty, "<>" where it isn't. =SUMIF(E2:E16,"",C2:C16) returns 0, because every sale has a name, and with "<>" you get all £134. If someone forgets to write their name, the first formula shows it straight away.
How do you use SUMIF with dates?
With the same operators as numbers, because to Excel a date is a number. Microsoft even lists TODAY() as possible criteria (Microsoft). Second Chance writes the day as text, so =SUMIF(D2:D16,"Sat",C2:C16) does the job there: £59 on Saturday. If column D held real dates, you'd write something like this:
=SUMIF(D2:D16,">="&DATE(2026,11,1),C2:C16)
=SUMIF(D2:D16,"<"&TODAY(),C2:C16)
=SUMIFS(C2:C16,D2:D16,">="&DATE(2026,11,1),D2:D16,"<"&DATE(2026,12,1))The first formula adds up everything from 1 November 2026, the second everything before today. Between two dates you need two conditions on the same column, and SUMIF can't do that, so you use SUMIFS. Test for less than 1 December rather than less than or equal to 30 November, and a sale at 3 pm on 30 November still counts.
Why is my SUMIF not working?
Most of the time SUMIF doesn't show an error, just a wrong amount, and often that amount is 0. That's what makes these mistakes sneaky: the sheet looks finished. Here are the causes you'll run into most often, each with its fix, and all on the Second Chance sheet.
SUMIF returns 0
Look at the criteria first. "Clothing " with a trailing space matches nothing, and neither does ">G2". If the space is in the cells themselves, you won't even see it. Microsoft names leading and trailing spaces, and a mix of straight and curly quotation marks, as causes of unexpected results (Microsoft). Clean those cells with TRIM. And check the sum range is there: =SUMIF(B2:B16,"Household") adds up column B itself, which is 0.
Numbers stored as text
SUMIF ignores blank cells and text (Microsoft), including text that looks like a number. If the 12 for Dress green is stored as text in C2, the clothing formula returns £34 instead of £46. You'll spot such a cell by its left alignment and often a small green triangle in the corner. Choose Convert to Number there, or set the format to General and confirm the cell again with F2 and Enter.
Excel won't accept the formula
Then there's usually an operator outside the quotation marks, as in =SUMIF(C2:C16,>10), or a semicolon where your Excel expects a comma. If you copy a formula from a European colleague or forum, translate two things: the separators and the function name. =SOM.ALS(C2:C16;">10") becomes =SUMIF(C2:C16,">10"). A Dutch name in an English copy of Excel shows #NAME?.
The sum range is shifted or shorter
SUMIF doesn't check that the sum range is the same size as the range. If it isn't, Excel starts at the first cell of the sum range and takes a block the same size as the range (Microsoft). So =SUMIF(B2:B16,"Clothing",C3:C16) adds up, for every clothing row, the price of the row below it: £44 instead of £46.
A sum range that's one row out doesn't give an error, it gives a believable wrong amount. Always start and end the range and the sum range on the same rows.
SUMIF puts the sum range last, SUMIFS first
In SUMIF the sum range is the third argument, in SUMIFS the first, and Microsoft points this out itself (Microsoft). So when you turn a SUMIF into a SUMIFS to add a condition, the sum range moves to the front. =SUMIFS(C2:C16,B2:B16,"Clothing") returns the same £46 as the example at the top.
Can SUMIF handle multiple criteria?
No, SUMIF takes one condition. When two conditions must both be true, use SUMIFS: =SUMIFS(C2:C16,B2:B16,"Clothing",E2:E16,"Sophie") returns £19, the clothing Sophie sold. SUMIFS takes up to 127 pairs of a range and its criteria (Microsoft). You'll learn to build them in the lesson on SUMIFS.
When either condition will do, add two SUMIFs together. =SUMIF(B2:B16,"Clothing",C2:C16)+SUMIF(B2:B16,"Books",C2:C16) returns £51: 46 for the clothing and 5 for the books. That works because a row only has one category. Add up the clothing and Sophie's sales the same way, though, and you get £76 instead of £57: the £19 of clothing Sophie sold is counted twice.
Which functions are like SUMIF?
SUMIF has a whole family, and every member reads its criteria the same way: the same operators, the same wildcards, the same & for a cell. Know one and you can write the others without much thought. Here they are on the Second Chance sheet, each one for the clothing:
| Function | What it does | Example | Result |
|---|---|---|---|
| SUMIFS | Adds up with one or more conditions | =SUMIFS(C2:C16,B2:B16,"Clothing") | £46 |
| COUNTIF | Counts the rows that meet a condition | =COUNTIF(B2:B16,"Clothing") | 6 items |
| AVERAGEIF | Averages what meets a condition | =AVERAGEIF(B2:B16,"Clothing",C2:C16) | £7.67 |
If you want to know how many items were sold rather than how many pounds, read the article on COUNTIF. Averages, with and without a condition, are covered in the article on AVERAGE. And if you want to decide something on every row rather than make a total, such as Pricey or Bargain next to each price, you need the IF function.
For the formulas you'll use most, see 12 basic Excel formulas everyone should know, and the Excel cheat sheet lists every function in the course with its English and Dutch name. To really get SUMIF under your fingers, take module 4 of the course: six short lessons on the Second Chance sheet, from COUNTIF to AVERAGEIF. Excel practice exercises with explanations shows what else there is to practise.
Frequently asked questions
What's the difference between SUMIF and SUMIFS?
SUMIF adds up with one condition, SUMIFS with one or more, up to 127 pairs of a range and its criteria. The order differs too. In SUMIF the sum range comes last, in SUMIFS it comes first. If you always use SUMIFS, you only have one order to remember, and adding a condition later is easy.
Why is my SUMIF returning 0?
Usually the criteria match nothing. Check for a space in the text or in the cells, whether you wrote ">"&G2 rather than ">G2", and whether the sum range is there. Without a sum range, SUMIF adds up the tested range itself, and a column of text gives 0. Numbers stored as text are skipped too.
Can SUMIF have multiple criteria?
No, SUMIF takes one condition. When two conditions must both be true, use SUMIFS, with the sum range first and then a range and criteria for each condition. When either one will do, add two SUMIF formulas together, but make sure a row that meets both isn't counted twice.
Is SUMIF case sensitive?
No. Criteria ignore case, so "clothing", "Clothing" and "CLOTHING" match the same rows. Spaces do count, though: "Clothing " with a trailing space matches nothing. If you really need to tell capitals from lower case, SUMIF on its own won't do it, and you'll need a different approach.
How do I use SUMIF between two dates?
Use SUMIFS, because you need two conditions on the same column: from the first date, and before the second. For example, =SUMIFS(C2:C16,D2:D16,">="&DATE(2026,11,1),D2:D16,"<"&DATE(2026,12,1)) adds up all of November. Testing for less than the next day also catches a time on the last day.
Practise this in the course
Every lesson explains first and then lets you practise yourself, with a real spreadsheet in your browser.
- SUMIFCounting and adding with conditions · Adding up what matches
- CriteriaCounting and adding with conditions · Criteria with operators
- WildcardsCounting and adding with conditions · Wildcards
- SUMIFSCounting and adding with conditions · Several conditions
Sources
- Microsoft Support, SUMIF function
- Microsoft Support, SUMIFS function
- Microsoft Support, COUNTIF function
- Microsoft Support, How to avoid broken formulas in Excel
Christophe, founder of Lurndo
Christophe builds Lurndo from Belgium, with short, playful exercises for SQL, Excel, HTML & CSS and touch typing that show straight away what your answer does. On this blog, Christophe answers the questions people run into while learning, with sources you can check yourself.
Read next
How to calculate an average in Excel: blanks, zeros, conditions and weighted averagesIt's one function, yet averages go wrong all the time. See how AVERAGE works, what it skips, and how to average without zeros, with a condition or with weights, on real spreadsheets.Excel · · 11 min read
COUNTIF examples: how to count text, numbers, blanks and duplicates in ExcelOne function, two arguments, and it still miscounts more often than you'd think. On a charity shop's sheet you'll see every kind of criterion at work, and you'll type the formula yourself.Excel · · 12 min read