SUMIFS with multiple criteria: total sales by province and product in Excel
Your manager sends a sales list and asks one question: how much did Gauteng sell? Then a second one: how much of that was kettles? You could filter, select and read the total off the screen each time. Or you could write one formula that answers it and updates itself when the list changes.
By the end of this post you will be able to total a column for one condition with SUMIF, use SUMIFS with multiple criteria, and add a "greater than" condition such as sales above R10 000. You will also see why the two functions put their arguments in a different order, which is the part that catches most people.
The sales list
Here is a short list of sales from four reps. Every example below uses it.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Rep | Province | Product | Sales |
| 2 | Thandi | Gauteng | Kettle 1.7L | R4 200 |
| 3 | Pieter | Western Cape | Toaster | R2 800 |
| 4 | Aisha | KwaZulu-Natal | Kettle 1.7L | R3 150 |
| 5 | Thandi | Gauteng | Toaster | R12 500 |
| 6 | Sipho | Gauteng | Kettle 1.2L | R1 900 |
| 7 | Pieter | Western Cape | Kettle 1.7L | R11 400 |
| 8 | Aisha | KwaZulu-Natal | Toaster | R2 600 |
| 9 | Sipho | Gauteng | Kettle 1.7L | R6 300 |
The full total is R44 850. Keep that number in mind. It is useful for checking your answers later.
SUMIF in Excel: one condition
SUMIF adds up the numbers in one column when another column matches a condition. Its pattern is:
=SUMIF(range, criteria, [sum_range])
- range is where Excel looks for the condition. Here, the provinces in B2:B9.
- criteria is what it looks for, such as
"Gauteng". - sum_range is the column to add up. Here, the sales in D2:D9.
So the Gauteng total is:
=SUMIF(B2:B9,"Gauteng",D2:D9)
The answer is R24 900: R4 200 + R12 500 + R1 900 + R6 300.
The square brackets around sum_range mean it is optional. If you leave it out, Excel adds up the range itself. That only makes sense when the condition and the numbers are in the same column, which brings us to the next example.
Adding a "greater than" condition
Say you want the total of all big sales, meaning anything above R10 000. The condition and the numbers are both in column D, so you can skip sum_range:
=SUMIF(D2:D9,">10000")
The answer is R23 900 (R12 500 + R11 400).
Two details matter here. The operator and the number go inside the quotes together, as ">10000". And you type the number plainly, with no R and no space.
If the threshold lives in a cell, say G1, join the operator to the cell with an ampersand:
=SUMIF(D2:D9,">"&G1)
Writing ">G1" will not work. Excel reads that as the text "G1", not the value in the cell.
SUMIFS with multiple criteria
Now the second question: Gauteng kettles only. That needs two conditions at once, so you move to SUMIFS. Its pattern is:
=SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)
Notice that the column you add up comes first this time. After it, you list the conditions in pairs: a range, then what to look for in that range.
For Gauteng sales of the 1.7-litre kettle:
=SUMIFS(D2:D9,B2:B9,"Gauteng",C2:C9,"Kettle 1.7L")
The answer is R10 500 (rows 2 and 9). Sipho's 1.2-litre kettle is left out, because "Kettle 1.2L" does not match "Kettle 1.7L" exactly.
To count every kettle, whatever the size, use the asterisk wildcard. An asterisk stands for any sequence of characters, so "Kettle*" matches anything that starts with "Kettle":
=SUMIFS(D2:D9,B2:B9,"Gauteng",C2:C9,"Kettle*")
Now the answer is R12 400, because the R1 900 row is included.
You can keep adding pairs. Gauteng sales above R10 000:
=SUMIFS(D2:D9,B2:B9,"Gauteng",D2:D9,">10000")
That returns R12 500, Thandi's toaster sale. The sum range and a criteria range can be the same column. That's allowed.
Excel's own documentation allows up to 127 range-and-criteria pairs, which is far more than you will ever need for a sales report.
SUMIF vs SUMIFS: why the order changes
This is the question people ask most. In SUMIF the sum range is last. In SUMIFS it is first.
Microsoft doesn't spell out why, but the layout makes sense once you see it. In SUMIF the sum range is optional, and optional arguments go at the end. In SUMIFS the sum range is required, and the number of conditions can grow. Putting the sum range first gives it a fixed place, with the condition pairs lined up after it.
A simple way to remember it:
- SUMIF: where to look, what to find, what to add.
- SUMIFS: what to add, then pairs of where to look and what to find.
There is one more difference. In SUMIFS, every range must be the same size. If D2:D9 is your sum range, each criteria range must also cover eight rows, or you get a #VALUE! error. SUMIF is more forgiving about sizes, but matching them is a good habit anyway.
Many people simply use SUMIFS for everything, even with one condition. It works fine, and you only have to remember one argument order.
One total per province
To build a small summary, put the province names in a column and point the condition at those cells instead of typing the text:
| F | G | |
|---|---|---|
| 1 | Province | Total |
| 2 | Gauteng | R24 900 |
| 3 | Western Cape | R14 200 |
| 4 | KwaZulu-Natal | R5 750 |
In G2, type:
=SUMIFS($D$2:$D$9,$B$2:$B$9,F2)
The dollar signs lock the data ranges, so you can copy the formula down to G4 and only F2 changes to F3 and F4. Select G2:G4 and press Ctrl+D (Windows) or Cmd+D (Mac) to fill down.
Then check your work: R24 900 + R14 200 + R5 750 = R44 850. That matches the full total from the start, so no rows have gone missing.
The same idea works for averages and counts
Once SUMIFS makes sense, its relatives follow the same pattern. COUNTIFS counts the rows that meet every condition. AVERAGEIFS averages them, again with the average range first. For example, the average Gauteng sale is:
=AVERAGEIFS(D2:D9,B2:B9,"Gauteng")
That gives R6 225 (R24 900 spread across four sales).
Practise it with instant marking
Reading formulas is one thing. Typing them until the argument order feels natural is what makes it stick.
- Lesson 18: SUMIF covers single conditions, including a comparison like
">10000". - Lesson 19: SUMIFS and COUNTIFS adds multiple criteria.
- Lesson 20: AVERAGEIF and AVERAGEIFS applies the same pattern to averages.
Each one runs in your browser and is marked the moment you press Enter. It's free and there's no sign-up. Start with lesson 19 if SUMIF already feels comfortable.