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 now

How 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

D2fx 
ABCDE
1CityCourse
2AddisExcel
3NairobiSQL
4AddisExcel
5LagosExcel
6NairobiPython
7AddisSQL
8
1

Addis comes first, then Nairobi and Lagos spill below.

Examples

Which cities appear?

=UNIQUE(A2:A7)Addis

Addis comes first, then Nairobi and Lagos spill below.

Which courses appear?

=UNIQUE(B2:B7)Excel

Values stay in the order they are first seen.

How many different city and course pairs?

=ROWS(UNIQUE(A2:B7))5

With 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.

ABCD
1CityCourse
2AddisExcel
3NairobiSQL
4AddisExcel
5LagosExcel
6NairobiPython
7AddisSQL
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.