Excel SUMIF function: sum by a condition — step by step
SUMIF adds up only the rows that meet a condition: city, category, ">="&F1, the * wildcard. The shifted-range trap and pro techniques.
SUMIF adds up numbers only in the rows that meet a condition. “What are total sales for Tashkent?”, “How much went on transport?”, “What is the sum of orders over 1 mln?” — each is one SUMIF.
It replaces “filter, then add up on a calculator”, and when the data changes the result updates by itself. Half of all small reports are built on SUMIF.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Manager | City | Amount | City | Total | ||
| 2 | Aziz | Tashkent | 1 250 000 | Tashkent | 4 260 000 | ||
| 3 | Dilnoza | Samarkand | 640 000 | ||||
| 4 | Javohir | Tashkent | 2 100 000 | ||||
| 5 | Kamola | Bukhara | 480 000 | ||||
| 6 | Sardor | Tashkent | 910 000 | ||||
| 7 | Malika | Samarkand | 1 730 000 | ||||
| 8 |
Syntax
=СУММЕСЛИ(range; criteria; [sum_range])
- range — where the condition is tested:
B2:B7(cities). - criteria — the condition:
"Tashkent",">=1000000",">="&F1,"Ph*". Written the same way as in COUNTIF. - sum_range — the numbers to add:
C2:C7. Optional: leave it out and Excel adds uprangeitself — handy when the condition is on the numbers:=СУММЕСЛИ(C2:C7;">=1000000").
Remember the order: condition first, then the sum. SUMIFS is the other way round — a major source of mistakes.
Step by step: entering SUMIF
1
Select F2 for the result.
2
Формулы → Математические → pick SUMIF from the list.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Manager | City | Amount | City | Total | ||
| 2 | Aziz | Tashkent | 1 250 000 | Tashkent | |||
| 3 | Dilnoza | Samarkand | 640 000 | ||||
| 4 | |||||||
| 5 |
3
Range — B2:B7 (cities), Criteria — "Tashkent" or cell E2, Sum_range — C2:C7 (amounts). Click OK.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Manager | City | Amount | City | Total | ||
| 2 | Aziz | Tashkent | 1 250 000 | Tashkent | |||
| 3 | Dilnoza | Samarkand | 640 000 | ||||
| 4 | |||||||
| 5 |
4
The result is 4,260,000. The finished formula: =СУММЕСЛИ(B2:B7;"Tashkent";C2:C7).
Example 1: one formula — a whole report
List the cities in column E and take the condition from the cell. Lock the ranges with $, fill the formula down, and you have a total for every city:
=СУММЕСЛИ($B$2:$B$7;E2;$C$2:$C$7)
Check: the city totals must add up to the overall SUM.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Manager | City | Amount | City | Total | ||
| 2 | Aziz | Tashkent | 1 250 000 | Tashkent | 4 260 000 | ||
| 3 | Dilnoza | Samarkand | 640 000 | Samarkand | 2 370 000 | ||
| 4 | Javohir | Tashkent | 2 100 000 | Bukhara | 480 000 | ||
| 5 | Kamola | Bukhara | 480 000 | All | 7 110 000 | ||
| 6 | Sardor | Tashkent | 910 000 | Check | 7 110 000 | ||
| 7 | Malika | Samarkand | 1 730 000 | ||||
| 8 |
Example 2: no sum_range, the * wildcard and a threshold in a cell
- When the condition is on the numbers themselves, you don’t need the third argument:
=СУММЕСЛИ(B2:B6;">="&F1)— the total of products priced at F1 or more. - By part of the text:
=СУММЕСЛИ(A2:A6;"Phone*";B2:B6)— every product whose name starts with “Phone”.
Note: when the threshold is in a cell, the sign stays in quotes and the cell is joined with &.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Product | Amount | Threshold | 3 000 000 | |||
| 2 | Phone Samsung A15 | 2 450 000 | Above threshold | 17 100 000 | |||
| 3 | Phone iPhone 13 | 7 900 000 | Phone* | 12 200 000 | |||
| 4 | Laptop HP | 6 200 000 | |||||
| 5 | Phone Redmi 12 | 1 850 000 | |||||
| 6 | Tablet Samsung | 3 000 000 | |||||
| 7 |
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Manager | City | Amount | Version | Result | ||
| 2 | Aziz | Tashkent | 1 250 000 | Right: C2:C7 | 4 260 000 | ||
| 3 | Dilnoza | Samarkand | 640 000 | Shifted: C3:C8 | 2 850 000 | ||
| 4 | Javohir | Tashkent | 2 100 000 | ||||
| 5 | Kamola | Bukhara | 480 000 | ||||
| 6 | Sardor | Tashkent | 910 000 | ||||
| 7 | Malika | Samarkand | 1 730 000 | ||||
| 8 |
Pro level: running totals, shares and “or”
- A running total within a category.
=СУММЕСЛИ($B$2:B2;B2;$C$2:C2)— the start of the range is locked, the end grows downward. Each row shows how much that city has accumulated so far. - A share.
=СУММЕСЛИ(B2:B7;"Tashkent";C2:C7)/СУММ(C2:C7)— what percentage of sales comes from Tashkent. - “Or”.
=СУММ(СУММЕСЛИ(B2:B7;{"Tashkent";"Samarkand"};C2:C7))— two cities together. - Blank cells.
=СУММЕСЛИ(B2:B7;"";C2:C7)— the total of orders with no city entered. Very useful for checking data quality. - Two or more conditions (city and month) — that’s SUMIFS.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Manager | City | Amount | Running total by city | |
| 2 | Aziz | Tashkent | 1 250 000 | 1 250 000 | |
| 3 | Dilnoza | Samarkand | 640 000 | 640 000 | |
| 4 | Javohir | Tashkent | 2 100 000 | 3 350 000 | |
| 5 | Kamola | Bukhara | 480 000 | 480 000 | |
| 6 | Sardor | Tashkent | 910 000 | 4 260 000 | |
| 7 | Malika | Samarkand | 1 730 000 | 2 370 000 | |
| 8 |
Try it in the simulator
Type =СУММЕСЛИ($B$2:$B$7;E2;$C$2:$C$7) in F2 and fill it down to F4 — you get a total for each city. Then type =СУММ(F2:F4) in F5 and compare it with the overall total.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Manager | City | Amount | City | Total | |||||||||||||||||||
| 2 | Aziz | Tashkent | 1250000 | Tashkent | ||||||||||||||||||||
| 3 | Dilnoza | Samarkand | 640000 | Samarkand | ||||||||||||||||||||
| 4 | Javohir | Tashkent | 2100000 | Bukhara | ||||||||||||||||||||
| 5 | Kamola | Bukhara | 480000 | All | ||||||||||||||||||||
| 6 | Sardor | Tashkent | 910000 | |||||||||||||||||||||
| 7 | Malika | Samarkand | 1730000 | |||||||||||||||||||||
| 8 | ||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.