Excel tutorial
/

Functions

Advanced

Excel FILTER function: extract matching rows automatically

Use the Excel FILTER function to pull rows that meet one or several conditions with a formula: if_empty, #SPILL! and #CALC! errors, and live reports.

A regular filter (Данные → Фильтр) only hides rows: the table stays where it is, and to move the result to another sheet you copy it by hand every time. FILTER returns the matching rows to a new place with a formula — and when the source changes, the result updates itself.

In real work this is a “live report”: a manager types a branch name into one cell and below it appear that branch’s managers and their sales. Type another branch and the list switches instantly. No macros, no manual copying.

FILTER is a dynamic array function: you enter it in one cell and the result “spills” into neighbouring cells. It is available only in Excel 2021 and Microsoft 365.

Книга1 - Excel
—☐✕
F1fxTashkent
ABCDEFG
1ManagerSalesBranchBranch:Tashkent1
2Aziz8 500 000TashkentManagerSales
3Dilnoza9 100 000SamarkandAziz28 500 000
4Javohir12 300 000TashkentJavohir12 300 000
5Madina4 200 000SamarkandSardor6 400 000
6Sardor6 400 000Tashkent
7Nodira7 800 000Bukhara
8
ГотовоСреднее: 9066666,6667Количество: 6Сумма: 27200000
One formula in E3: =FILTER(A2:B7,C2:C7=F1). Type “Samarkand” in F1 and the list changes by itself

Syntax

=ФИЛЬТР(array; include; [if_empty])

  • array — the range that goes into the result. Leave the header out: A2:B7.
  • include — the condition: a TRUE/FALSE array with the same number of rows as array, such as C2:C7=F1 or B2:B7>=5000000.
  • if_empty — what to show when nothing matches: "Not found". Without it you get #CALC!.

Several conditions:

  • AND — wrap each condition in brackets and multiply: (C2:C7="Tashkent")*(B2:B7>=8000000).
  • OR — add them: (C2:C7="Samarkand")+(C2:C7="Bukhara").

TRUE×TRUE = 1, every other combination gives 0. FILTER keeps the rows with 1 (or any non-zero number).

A live report by branch

1

Set up a cell for the condition: “Branch:” in E1 and “Tashkent” in F1. Type the headers above the result (E2:F2) yourself — FILTER doesn’t return headers.

2

Select E3 and click Формулы → Ссылки и массивы → FILTER.

Книга1 - Excel
—☐✕
ФайлГлавнаяВставкаРазметка страницыФормулыДанныеРецензированиеВидСправка
Вставить функциюАвтосуммаФинансовыеЛогическиеТекстовыеДата и времяСсылки и массивыМатематические
Библиотека функций
Диспетчер имён
Определённые имена
E3fx
ABCDEFG
1ManagerSalesBranchBranch:Tashkent
2Aziz8 500 000TashkentManagerSales
3Dilnoza9 100 000Samarkand
4Javohir12 300 000Tashkent
5
Готово

3

Array — A2:B7, Include — C2:C7=F1, If_empty — "Not found". Click OK, or type the formula yourself: =ФИЛЬТР(A2:B7;C2:C7=F1;"Not found").

Книга1 - Excel
—☐✕
E3fx
ABCDEFG
1ManagerSalesBranchBranch:Tashkent
2Aziz8 500 000TashkentManagerSales
3Dilnoza9 100 000Samarkand
4Javohir12 300 000Tashkent
5
Готово

4

The result spills into E3:F5 (Excel marks it with a blue border). Now change F1 to “Samarkand” — the list updates instantly.

Книга1 - Excel
—☐✕
F1fxSamarkand
ABCDEFG
1ManagerSalesBranchBranch:Samarkand
2Aziz8 500 000TashkentManagerSales
3Dilnoza9 100 000SamarkandDilnoza9 100 000
4Javohir12 300 000TashkentMadina4 200 000
5Madina4 200 000Samarkand
6Sardor6 400 000Tashkent
7Nodira7 800 000Bukhara
8
ГотовоСреднее: 6650000Количество: 4Сумма: 13300000
The formula didn’t change — only the condition in F1 did
Книга1 - Excel
—☐✕
E2fx=ФИЛЬТР(A2:B7;C2:C7)
ABCDEFG
1ProductPriceSelectedOrderPrice
2Bread4 000ИСТИНАBread4 000
3Milk12 000ЛОЖЬRice18 500
4Rice18 500ИСТИНАTea35 000
5Tea35 000ИСТИНАOil28 000
6Sugar14 000ЛОЖЬ
7Oil28 000ИСТИНА
8
ГотовоСреднее: 21375Количество: 8Сумма: 85500
Example 1: column C holds TRUE/FALSE (in Microsoft 365 that’s an in-cell checkbox). The column itself is enough as include: =FILTER(A2:B7,C2:C7)
Книга1 - Excel
—☐✕
E2fxAziz
ABCDEFG
1ManagerSalesBranchManagerSales
2Aziz8 500 000TashkentAziz8 500 000
3Dilnoza9 100 000SamarkandJavohir12 300 000
4Javohir12 300 000Tashkent
5Madina4 200 000Samarkand
6Sardor6 400 000Tashkent
7Nodira7 800 000Bukhara
8
ГотовоСреднее: 10400000Количество: 4Сумма: 20800000
Example 2, two conditions (AND): =FILTER(A2:B7,(C2:C7="Tashkent")*(B2:B7>=8000000)) — Tashkent managers with 8 million or more. Sardor (6.4 million) drops out
Книга1 - Excel
—☐✕
E2fx=СОРТ(ФИЛЬТР(A2:B7;C2:C7);2;-1)
ABCDEFG
1ProductPriceSelectedMost expensivePrice
2Bread4 000ИСТИНАTea35 000
3Milk12 000ЛОЖЬOil28 000
4Rice18 500ИСТИНАRice18 500
5Tea35 000ИСТИНАBread4 000
6Sugar14 000ЛОЖЬ
7Oil28 000ИСТИНА
8
ГотовоСреднее: 21375Количество: 8Сумма: 85500
Example 3: pass the FILTER result to SORT — the selected products from the most to the least expensive
Книга1 - Excel
—☐✕
E2fx=ФИЛЬТР(A2:B7;C2:C7)
ABCDEFG
1ProductPriceSelectedOrderPrice
2Bread4 000ИСТИНА#SPILL!
3Milk12 000ЛОЖЬ
4Rice18 500ИСТИНАold1
5Tea35 000ИСТИНА
6Sugar14 000ЛОЖЬ
7Oil28 000ИСТИНА
8
ГотовоКоличество: 2
#SPILL!: the word “old” in E4 blocks the result’s path. Delete it and the list appears immediately

Pro level: a search box, calculations on the result, picking columns

  • “Contains” search. =ФИЛЬТР(A2:C100;ЕЧИСЛО(ПОИСК(F1;A2:A100));"Not found") — type “aziz” in F1 and every name containing that fragment appears. A simple search box right on the sheet.
  • Calculate on the result. =СУММ(ФИЛЬТР(B2:B7;C2:C7=F1)), =СЧЁТЗ(ФИЛЬТР(...)) — like SUMIF, but with conditions of any complexity.
  • Refer to the whole spill. If the result starts in E3, refer to it as E3#: =СУММ(F3#) keeps working when the number of rows changes.
  • Only the columns you need. In Microsoft 365: =CHOOSECOLS(ФИЛЬТР(A2:E100;C2:C100=F1);1;4) returns columns 1 and 4.
  • Date ranges. =ФИЛЬТР(A2:C100;(B2:B100>=F1)*(B2:B100<=F2)) — orders between two dates.
  • Turn the source into an Excel Table (Ctrl + T) and use references like Sales[Branch] — new rows are picked up automatically.

Try it in the simulator

Column C marks (TRUE) the products a customer picked. Type =ФИЛЬТР(A2:B7;C2:C7) in E2. Then type the order total =СУММ(ФИЛЬТР(B2:B7;C2:C7)) in B8. Finally change C3 to TRUE and watch the list and the total update.

Книга1 - Excel
—☐✕
Буфер обмена
Шрифт
Выравнивание
Число
Стили
Ячейки
Редактирование
✕✓fx
ABCDEFGHIJKLMNOPQRSTUVWX
1ProductPriceSelectedOrderPrice
2Bread4000ИСТИНА
3Milk12000ЛОЖЬ
4Rice18500ИСТИНА
5Tea35000ИСТИНА
6Sugar14000ЛОЖЬ
7Oil28000ИСТИНА
8Total:
9
10
11
12
Лист1
Готово

Has ExcelLab been useful?

Support the project and help us release new lessons and exercises.

Support us
Previous

136 / 154