Excel UNIQUE
UNIQUE returns each different value in a range once, as a live list that updates with your data.
A training coordinator has one row per enrollment and needs to know which cities and courses appear at all. Remove Duplicates would destroy the original rows. UNIQUE leaves the source alone and builds the headings for a summary table automatically.
Practice it nowHow to write it
=UNIQUE(array, [by_col], [exactly_once])- array
- The range to scan.
- by_col
- Optional. TRUE compares columns rather than rows.
- exactly_once
- Optional. TRUE keeps only values that appear one time.
Watch it work
Examples
Which cities appear?
=UNIQUE(A2:A7)AddisAddis comes first, then Nairobi and Lagos spill below.
Which courses appear?
=UNIQUE(B2:B7)ExcelValues stay in the order they are first seen.
How many different city and course pairs?
=ROWS(UNIQUE(A2:B7))5With two columns, a whole row must repeat to count as a duplicate. Only Addis and Excel repeats.
Your turn
Count how many different courses are in column B. Type your formula in D2.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | City | Course | ||
| 2 | Addis | Excel | ||
| 3 | Nairobi | SQL | ||
| 4 | Addis | Excel | ||
| 5 | Lagos | Excel | ||
| 6 | Nairobi | Python | ||
| 7 | Addis | SQL | ||
| 8 |
Common mistakes
Treating "Addis" and "Addis " as one city.
The trailing space makes them different. Clean with TRIM first.
Expecting exactly_once to mean distinct.
It removes every value that repeats, which is a different question.
Good to know
- Wrap it in SORT for an alphabetical list.
- Point a SUMIFS at each spilled value to build a self-extending summary.
- UNIQUE or Remove Duplicates? Remove Duplicates permanently deletes rows. UNIQUE keeps the source and recalculates.
Excelio