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.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Customer | Amount | Customers | ||
| 2 | Javohir | 800 000 | Javohir | ||
| 3 | Aziz | 450 000 | Aziz | ||
| 4 | Madina | 500 000 | Madina | ||
| 5 | Aziz | 300 000 | Dilnoza | ||
| 6 | Dilnoza | 1 200 000 | |||
| 7 | Javohir | 650 000 | |||
| 8 | Aziz | 700 000 | |||
| 9 |
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.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Customer | Amount | Customers | ||
| 2 | Javohir | 800 000 | |||
| 3 | Aziz | 450 000 | |||
| 4 | Madina | 500 000 | |||
| 5 |
3
Enter A2:A8 in Array, leave the rest empty and click OK. The result spills into D2:D5.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Customer | Amount | Customers | ||
| 2 | Javohir | 800 000 | Javohir | ||
| 3 | Aziz | 450 000 | Aziz | ||
| 4 | Madina | 500 000 | Madina | ||
| 5 | Aziz | 300 000 | Dilnoza | ||
| 6 | Dilnoza | 1 200 000 | |||
| 7 | Javohir | 650 000 | |||
| 8 | Aziz | 700 000 | |||
| 9 |
4
Now change the source: replace Aziz in A8 with a new customer, Nodira. The list grows to 5 names by itself.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Customer | Amount | Customers | ||
| 2 | Javohir | 800 000 | Javohir | ||
| 3 | Aziz | 450 000 | Aziz | ||
| 4 | Madina | 500 000 | Madina | ||
| 5 | Aziz | 300 000 | Dilnoza | ||
| 6 | Dilnoza | 1 200 000 | Nodira1 | ||
| 7 | Javohir | 650 000 | |||
| 8 | Nodira | 700 000 | |||
| 9 |
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Customer | Amount | How many customers? | ||
| 2 | Javohir | 800 000 | 4 | ||
| 3 | Aziz | 450 000 | |||
| 4 | Madina | 500 000 | |||
| 5 | Aziz | 300 000 | |||
| 6 | Dilnoza | 1 200 000 | |||
| 7 | Javohir | 650 000 | |||
| 8 | Aziz | 700 000 | |||
| 9 |
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Customer | Amount | Customer | Total | ||
| 2 | Javohir | 800 000 | Aziz | 1 450 000 | ||
| 3 | Aziz | 450 000 | Dilnoza | 1 200 000 | ||
| 4 | Madina | 500 000 | Javohir | 1 450 000 | ||
| 5 | Aziz | 300 000 | Madina | 500 000 | ||
| 6 | Dilnoza | 1 200 000 | ||||
| 7 | Javohir | 650 000 | ||||
| 8 | Aziz | 700 000 | ||||
| 9 |
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Customer | Amount | One-time | ||
| 2 | Javohir | 800 000 | Madina | ||
| 3 | Aziz | 450 000 | Dilnoza | ||
| 4 | Madina | 500 000 | |||
| 5 | Aziz | 300 000 | |||
| 6 | Dilnoza | 1 200 000 | |||
| 7 | Javohir | 650 000 | |||
| 8 | Aziz | 700 000 | |||
| 9 |
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Customer | UNIQUE result | ||
| 2 | Aziz | Aziz | ||
| 3 | AZIZ | Aziz | ||
| 4 | Aziz 1 | 02 | ||
| 5 | Dilnoza | |||
| 6 | Dilnoza | |||
| 7 |
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.
| 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 | Customer | Amount | Customer | Total | Count | |||||||||||||||||||
| 2 | Javohir | 800000 | ||||||||||||||||||||||
| 3 | Aziz | 450000 | ||||||||||||||||||||||
| 4 | Madina | 500000 | ||||||||||||||||||||||
| 5 | Aziz | 300000 | ||||||||||||||||||||||
| 6 | Dilnoza | 1200000 | ||||||||||||||||||||||
| 7 | Javohir | 650000 | ||||||||||||||||||||||
| 8 | Aziz | 700000 | ||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||
| 12 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.