Excel tutorial
/

Data analysis

Advanced

Excel Advanced Filter: AND/OR criteria and copying results to another location

Advanced Filter: the criteria range, AND/OR logic, copying results elsewhere, unique records, formula criteria and the “Tashkent region” trap.

The regular filter (Ctrl + Shift + L) is fine for everyday work, but it has limits: you can’t set OR across columns (“Tashkent or amount over 10 mln”), you can’t send the result to a separate place, and the criteria are invisible — a colleague opening the file can’t tell what was filtered.

The Advanced Filter solves this: criteria are written on the sheet itself, in a separate criteria range. They are always visible, easy to change, and the result can be copied next to the table or elsewhere.

Книга1 - Excel
—☐✕
fx
ABCDEFGH
1ManagerCityAmount, mln
2=Tashkent>5
3
4ManagerCityAmount, mlnManagerCityAmount, mln
5AzizTashkent4,5JavohirTashkent6,8
6DilnozaSamarkand7,2AzizTashkent8,3
7JavohirTashkent6,8
8MalikaTashkent region9,1
9SardorBukhara12,4
10NodiraSamarkand3,9
11AzizTashkent8,3
12
Готово
Yellow — criteria range (A1:C2), blue — the source table, green — the result: Tashkent and over 5 mln

Advanced Filter — 4 steps

1

Build a criteria range above the table: copy the column headers exactly (A1:C1) and write the conditions beneath them. Leave at least one blank row between the criteria and the table.

Книга1 - Excel
—☐✕
B2fx="=Tashkent"
ABCD
1ManagerCityAmount, mln
2=Tashkent1>5
3
4ManagerCityAmount, mln
5AzizTashkent4,5
6DilnozaSamarkand7,2
7JavohirTashkent6,8
8MalikaTashkent region9,1
9
ГотовоКоличество: 5
B2 holds ="=Tashkent" — exactly the value “Tashkent” (why — see the trap below)

2

Click any cell in the source table (for example A5). Then on the Данные tab, in the Sort & Filter group, choose Advanced.

3

In the dialog choose Copy to another location and check the ranges: List range — the table with its header ($A$4:$C$11), Criteria range — the criteria with their header ($A$1:$C$2), Copy to — the cell where the result starts ($E$4).

Книга1 - Excel
—☐✕
ФайлГлавнаяВставкаРазметка страницыФормулыДанныеРецензированиеВидСправка
Получить данныеОбновить все
Получить данные
СортировкаФильтр
Сортировка и фильтр
Текст по столбцамУдалить дубликатыПроверка данных
Работа с данными
A5fxAziz
ABCD
1ManagerCityAmount, mln
2=Tashkent>5
3
4ManagerCityAmount, mln
5AzizTashkent4,5
6DilnozaSamarkand7,2
7JavohirTashkent6,8
8MalikaTashkent region9,1
9
Готово
Data → Sort & Filter → Advanced: the Advanced Filter dialog

4

Click OK. Starting at E4, Excel copies the headers and the matching rows — as in the picture at the top. The source table stays untouched.

Writing criteria: AND and OR

One golden rule: conditions on the same row mean AND, conditions on different rows mean OR.

  • Tashkent and >5 on one row — “Tashkent AND over 5”.
  • Tashkent on row 2, Samarkand on row 3 — “Tashkent OR Samarkand”.
  • For a range on one column (5 to 9), write the header twice: Amount, mln | Amount, mln, with >=5 and <=9 beneath.

Comparison operators: >, <, >=, <=, <> (not equal). A blank cell means “no condition on this column”.

Книга1 - Excel
—☐✕
fx
ABCDE
1ManagerCityAmount, mlnAmount, mln
2Tashkent>=5<=9
3Samarkand
4
5
Готово
(Tashkent AND amount 5–9 mln) OR (Samarkand with any amount)
Книга1 - Excel
—☐✕
fx
ABCDEFGH
1ManagerCityAmount, mln
2Tashkent>5
3
4ManagerCityAmount, mlnManagerCityAmount, mln
5AzizTashkent4,5JavohirTashkent6,8
6DilnozaSamarkand7,2MalikaTashkent region19,1
7JavohirTashkent6,8AzizTashkent8,3
8MalikaTashkent region9,1
9SardorBukhara12,4
10NodiraSamarkand3,9
11AzizTashkent8,3
12
Готово
B2 holds a plain “Tashkent” — “Tashkent region” got into the result too

Pro level: formula criteria, unique lists and wildcards

Formula criteria. The criteria range can hold a formula too — for example, “amount above average”. Two rules:

  • The header above the formula must differ from every table header (or be blank): e.g. “Above average”.
  • The formula refers to the first data row with a relative reference: =C5>СРЗНАЧ($C$5:$C$11). The cell shows TRUE/FALSE — that’s normal; Excel re-evaluates the formula for each row.

Unique records. The Unique records only box gives you a list without duplicates. For instance, set List range to column B only and run it with no criteria — a unique list of cities is ready. This works in Excel 2016 too (UNIQUE exists only in Excel 2021/365).

Wildcards: *region — ends with “region”, ? — any single character. <>Tashkent — everything except Tashkent.

Книга1 - Excel
—☐✕
A2fx=C5>СРЗНАЧ($C$5:$C$11)
ABCDEFGH
1Above average
2ЛОЖЬ
3
4ManagerCityAmount, mlnManagerCityAmount, mln
5AzizTashkent4,5MalikaTashkent region9,1
6DilnozaSamarkand7,2SardorBukhara12,4
7JavohirTashkent6,8AzizTashkent8,3
8MalikaTashkent region9,1
9SardorBukhara12,4
10NodiraSamarkand3,9
11AzizTashkent8,3
12
Готово
Criteria range = $A$1:$A$2. The average is 7.46 mln — the result holds the three orders above it

Try it in the simulator

See the “starts with” logic using COUNTIF: type =СЧЁТЕСЛИ(B2:B8;"Tashkent") (exact match) in E2 and =СЧЁТЕСЛИ(B2:B8;"Tashkent*") in E3 (this is how a plain “Tashkent” behaves in the Advanced Filter). The difference is “Tashkent region”.

Книга1 - Excel
—☐✕
Буфер обмена
Шрифт
Выравнивание
Число
Стили
Ячейки
Редактирование
✕✓fx
ABCDEFGHIJKLMNOPQRSTUVWX
1ManagerCityAmount, mlnResult
2AzizTashkent4,5
3DilnozaSamarkand7,2
4JavohirTashkent6,8
5MalikaTashkent region9,1
6SardorBukhara12,4
7NodiraSamarkand3,9
8AzizTashkent8,3
9
10
11
12
Лист1
Готово

Has ExcelLab been useful?

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

Support us
Previous

54 / 154