Excel tutorial
/

Functions

Advanced

Excel UNIQUE function: get a list of distinct values with a formula

Use Excel UNIQUE to list and count distinct customers or products: SORT+UNIQUE, a mini report with SUMIF, exactly_once, and traps with spaces and blank cells.

In a sales log one customer shows up dozens of times. For a report, though, you need each customer once: a list, a drop-down menu, or the answer to “how many customers do we have?”.

Данные → Удалить дубликаты can do it, but it deletes data and is a one-off: when tomorrow’s orders arrive you do it all again. UNIQUE leaves the source alone — it returns the distinct values to a new place with a formula and updates itself whenever the log changes.

UNIQUE is a dynamic array function; the result spills down. It works in Excel 2021 and Microsoft 365.

Книга1 - Excel
—☐✕
D2fx=УНИК(A2:A8)
ABCDE
1CustomerAmountCustomers
2Javohir800 000Javohir
3Aziz450 000Aziz
4Madina500 000Madina
5Aziz300 000Dilnoza
6Dilnoza1 200 000
7Javohir650 000
8Aziz700 000
9
ГотовоКоличество: 4
7 orders, 4 customers. Aziz appears three times in the log and once in the result. Order follows first appearance

Syntax

=УНИК(array; [by_col]; [exactly_once])

  • array — the range to remove repeats from: A2:A8. With several columns (A2:B8) you get distinct rows (combinations).
  • by_col — FALSE (default) compares rows; TRUE compares columns (for a horizontal list).
  • exactly_once — FALSE (default) returns each value once; TRUE returns only values that occur exactly once.

To skip the middle argument, keep the comma: =УНИК(A2:A8;;ИСТИНА).

Getting a customer list

1

Pick an empty column for the result and type its header yourself (D1 “Customers”). Keep the cells below empty.

2

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

Книга1 - Excel
—☐✕
ФайлГлавнаяВставкаРазметка страницыФормулыДанныеРецензированиеВидСправка
Вставить функциюАвтосуммаФинансовыеЛогическиеТекстовыеДата и времяСсылки и массивыМатематические
Библиотека функций
Диспетчер имён
Определённые имена
D2fx
ABCDE
1CustomerAmountCustomers
2Javohir800 000
3Aziz450 000
4Madina500 000
5
Готово

3

Enter A2:A8 in Array, leave the rest empty and click OK. The result spills into D2:D5.

Книга1 - Excel
—☐✕
D2fx=УНИК(A2:A8)
ABCDE
1CustomerAmountCustomers
2Javohir800 000Javohir
3Aziz450 000Aziz
4Madina500 000Madina
5Aziz300 000Dilnoza
6Dilnoza1 200 000
7Javohir650 000
8Aziz700 000
9
Готово

4

Now change the source: replace Aziz in A8 with a new customer, Nodira. The list grows to 5 names by itself.

Книга1 - Excel
—☐✕
A8fxNodira
ABCDE
1CustomerAmountCustomers
2Javohir800 000Javohir
3Aziz450 000Aziz
4Madina500 000Madina
5Aziz300 000Dilnoza
6Dilnoza1 200 000Nodira1
7Javohir650 000
8Nodira700 000
9
ГотовоКоличество: 5
The new customer joined the end of the list — nothing was updated by hand
Книга1 - Excel
—☐✕
D2fx=СЧЁТЗ(УНИК(A2:A8))
ABCDE
1CustomerAmountHow many customers?
2Javohir800 0004
3Aziz450 000
4Madina500 000
5Aziz300 000
6Dilnoza1 200 000
7Javohir650 000
8Aziz700 000
9
Готово
Example 1: counting distinct values. The old way was a clumsy SUMPRODUCT/COUNTIF formula; now COUNTA(UNIQUE()) does it
Книга1 - Excel
—☐✕
D2fx=СОРТ(УНИК(A2:A8))
ABCDEF
1CustomerAmountCustomerTotal
2Javohir800 000Aziz1 450 000
3Aziz450 000Dilnoza1 200 000
4Madina500 000Javohir1 450 000
5Aziz300 000Madina500 000
6Dilnoza1 200 000
7Javohir650 000
8Aziz700 000
9
ГотовоКоличество: 4
Example 2: SORT(UNIQUE()) gives an alphabetical list, SUMIF next to it gives each customer’s total. A mini report without a PivotTable
Книга1 - Excel
—☐✕
D2fxMadina
ABCDE
1CustomerAmountOne-time
2Javohir800 000Madina
3Aziz450 000Dilnoza
4Madina500 000
5Aziz300 000
6Dilnoza1 200 000
7Javohir650 000
8Aziz700 000
9
ГотовоКоличество: 2
Example 3: =UNIQUE(A2:A8,,TRUE) — only customers who bought once. A good list for a “come back” promotion
Книга1 - Excel
—☐✕
C2fxAziz
ABCD
1CustomerUNIQUE result
2AzizAziz
3AZIZAziz
4Aziz 102
5Dilnoza
6Dilnoza
7
ГотовоСреднее: 0Количество: 4Сумма: 0
=UNIQUE(A2:A6): AZIZ merged with Aziz, but “Aziz ” with a trailing space stayed separate (1), and the blank cell became 0 (2)

Pro level: drop-down lists, conditional distinct values, combinations

  • A self-updating drop-down list. If the UNIQUE result starts in D2: Данные → Проверка данных → List, Source: =$D$2#. A new customer in the log shows up in the menu too.
  • A report driven by the spill. =СУММЕСЛИ(A2:A8;D2#;B2:B8) — one formula returns totals for the whole column at once (Microsoft 365 / Excel 2021).
  • Distinct with a condition. =УНИК(ФИЛЬТР(A2:A100;C2:C100="Tashkent")) — Tashkent customers only; their count: =СЧЁТЗ(УНИК(ФИЛЬТР(...))).
  • Combinations. =УНИК(A2:B100) — distinct “branch + manager” pairs.
  • A horizontal header. =ТРАНСП(СОРТ(УНИК(A2:A100))) puts customer names across columns, for example as the header of a monthly table.

Try it in the simulator

Type =СОРТ(УНИК(A2:A8)) in D2 to get an alphabetical customer list. Then type =СЧЁТЗ(УНИК(A2:A8)) in F2 to see how many customers there are. Bonus: type =СУММЕСЛИ($A$2:$A$8;D2;$B$2:$B$8) in E2 and fill it down to E5.

Книга1 - Excel
—☐✕
Буфер обмена
Шрифт
Выравнивание
Число
Стили
Ячейки
Редактирование
✕✓fx
ABCDEFGHIJKLMNOPQRSTUVWX
1CustomerAmountCustomerTotalCount
2Javohir800000
3Aziz450000
4Madina500000
5Aziz300000
6Dilnoza1200000
7Javohir650000
8Aziz700000
9
10
11
12
Лист1
Готово

Has ExcelLab been useful?

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

Support us
Previous

138 / 154