Excel SUBTOTAL: totals that include only visible rows in a filtered table
SUBTOTAL skips rows hidden by a filter: sum, average, count, MAX/MIN in one function. The 9 vs 109 difference, nested subtotals and common traps.
You filtered the sales table down to Tashkent, yet =СУММ(C2:C7) at the bottom still shows the total of the whole table. SUM adds hidden rows too — it doesn’t “see” the filter.
SUBTOTAL solves exactly this: it only counts visible rows. Change the filter and the total changes with it.
On top of that, one function covers 11 operations (sum, average, count, MAX, MIN…) and never re-adds the results of other SUBTOTALs — ideal for reports with subtotals.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Branch | Manager | Sales (m) | |
| 2 | Tashkent | Aziz | 120 | |
| 3 | Samarkand | Dilnoza | 85 | |
| 4 | Tashkent | Javohir | 140 | |
| 5 | Bukhara | Malika | 60 | |
| 6 | Samarkand | Sardor | 95 | |
| 7 | Tashkent | Nodira | 110 | |
| 8 | Total | 610 | ||
| 9 |
Syntax
=ПРОМЕЖУТОЧНЫЕ.ИТОГИ(function_num; ref1; [ref2]; ...)
- function_num — which operation to perform (a code). The most common: 9 — SUM, 1 — AVERAGE, 2 — COUNT, 3 — COUNTA, 4 — MAX, 5 — MIN.
- ref1, ref2, … — the ranges to calculate.
Each code comes in two flavours:
- 1–11 — skip rows hidden by a filter but include rows hidden manually (Hide).
- 101–111 — skip both: only what you can see on screen.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Operation | Code 1–11 | Code 101–111 | |
| 2 | AVERAGE | 1 | 101 | |
| 3 | COUNT | 2 | 102 | |
| 4 | COUNTA | 3 | 103 | |
| 5 | MAX | 4 | 104 | |
| 6 | MIN | 5 | 105 | |
| 7 | STDEV.S | 7 | 107 | |
| 8 | SUM | 9 | 109 | |
| 9 |
Filter + SUBTOTAL step by step
1
Select any cell in the table and click Данные → Фильтр (Ctrl + Shift + L). Arrows appear in the headers.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Branch | Manager | Sales (m) | |
| 2 | Tashkent | Aziz | 120 | |
| 3 | Samarkand | Dilnoza | 85 | |
| 4 | Tashkent | Javohir | 140 | |
| 5 |
2
Click the Branch arrow and keep only Tashkent.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Branch | Manager | Sales (m) | |
| 2 | Tashkent | Aziz | 120 | |
| 3 | Samarkand | Dilnoza | 85 | |
| 4 | Tashkent | Javohir | 140 | |
| 5 |
3
Select the cell below the table and click Автосумма (Alt + =). With a filter on, Excel itself writes =ПРОМЕЖУТОЧНЫЕ.ИТОГИ(9;C2:C7) instead of SUM. The result is the sum of visible rows only.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Branch | Manager | Sales (m) | |
| 2 | Tashkent | Aziz | 120 | |
| 3 | Tashkent | Javohir | 140 | |
| 4 | Tashkent | Nodira | 110 | |
| 5 | SUBTOTAL(9) | 370 | ||
| 6 | SUM | 610 | ||
| 7 |
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Branch | Sales (m) | Measure | Value | ||
| 2 | Tashkent | 120 | Sum (9) | 610 | ||
| 3 | Samarkand | 85 | Average (1) | 101,7 | ||
| 4 | Tashkent | 140 | Count (2) | 6 | ||
| 5 | Bukhara | 60 | Max (4) | 140 | ||
| 6 | Samarkand | 95 | Min (5) | 60 | ||
| 7 | Tashkent | 110 | ||||
| 8 |
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Branch | Manager | Sales (m) | |
| 2 | Tashkent | Aziz | 120 | |
| 3 | Tashkent | Javohir | 140 | |
| 4 | Tashkent total | 260 | ||
| 5 | Samarkand | Dilnoza | 85 | |
| 6 | Samarkand | Sardor | 95 | |
| 7 | Samarkand total | 180 | ||
| 8 | Grand total | 440 | ||
| 9 |
=ПРОМЕЖУТОЧНЫЕ.ИТОГИ(9;C2:C7) — 440. The subtotals (260 and 180) aren’t added again. SUM would give 880 — every sale counted twicePro level: numbering, AGGREGATE and the table total row
- 1, 2, 3… even after filtering: type
=ПРОМЕЖУТОЧНЫЕ.ИТОГИ(3;$B$2:B2)in A2 and fill down. After filtering, visible rows renumber from 1. - “Showing 3 of 6”:
=ПРОМЕЖУТОЧНЫЕ.ИТОГИ(3;A2:A7)&" of "&СЧЁТЗ(A2:A7)— show the filter state in the report header. - AGGREGATE is the stronger sibling: it can skip errors too.
=AGGREGATE(9;7;C2:C100)sums without hidden rows and without errors like #N/A. It has 19 operations, including MEDIAN (12), LARGE (14) and SMALL (15). - Table total row: format the data as a Table and turn on Table Design → Total Row — Excel puts
SUBTOTAL(109,…)there for you. - <<tab:Data>> → Subtotal adds SUBTOTAL rows for every group of a sorted list and builds outline buttons (1, 2, 3) on the left.
Try it in the simulator
Type =ПРОМЕЖУТОЧНЫЕ.ИТОГИ(9;C2:C7) in C8 and =ПРОМЕЖУТОЧНЫЕ.ИТОГИ(1;C2:C7) in C9. Then change C3 to 200 — both results update. Note: the simulator’s SUBTOTAL doesn’t distinguish hidden rows — try the filter difference in real Excel.
| 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 | Branch | Manager | Sales (m) | |||||||||||||||||||||
| 2 | Tashkent | Aziz | 120 | |||||||||||||||||||||
| 3 | Samarkand | Dilnoza | 85 | |||||||||||||||||||||
| 4 | Tashkent | Javohir | 140 | |||||||||||||||||||||
| 5 | Bukhara | Malika | 60 | |||||||||||||||||||||
| 6 | Samarkand | Sardor | 95 | |||||||||||||||||||||
| 7 | Tashkent | Nodira | 110 | |||||||||||||||||||||
| 8 | Total | |||||||||||||||||||||||
| 9 | Average | |||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||
| 12 | ||||||||||||||||||||||||
| 13 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.