Excel function

UNIQUEfunction

Returns the values (or rows) of a range with duplicates removed.

Excel 2021+
=UNIQUE(B2:B9)
A
B
C
D
E
F
1
2
3
4
5
6
7
8
9

Drag the corner dots to change array. Widen the range to A2:B9 to compare branch and product as a pair. Switch to exactly once and values that appear more than once drop out entirely. Try breaking it on purpose to see the errors.

Result

{"Apple";"Milk";"Bread";"Coffee"}

array
B2:B9Drag the corner dots on the table

The range to remove duplicates from. With several columns, a whole row must match to count as a duplicate.

exactly_once

FALSE (default) keeps one of each value; TRUE keeps only values that appear exactly once.

What is the UNIQUE function?

=UNIQUE(array, [by_col], [exactly_once])

UNIQUE returns a list with duplicates removed. Use it to pull a list of products or branches out of sales records. When values are added to the source, the list updates.

With several columns, each whole row is compared as one. Set the third argument to TRUE to drop duplicated values entirely and keep only those that appear exactly once. Per Microsoft documentation, it is available in Excel 2021 and later and Microsoft 365.

Arguments

array
The range to remove duplicates from.
by_col
Optional. FALSE (default) compares rows and returns unique rows; TRUE compares columns and returns unique columns.
exactly_once
Optional. FALSE (default) returns every distinct value; TRUE returns only values that appear exactly once.

UNIQUE examples

  1. Example 1. Product list

    =UNIQUE(B2:B9)

    Returns 4 products: Apple, Milk, Bread and Coffee.

  2. Example 2. Products sold only once

    =UNIQUE(B2:B9, FALSE, TRUE)

    Only Coffee, which appears once.

  3. Example 3. Sorted list

    =SORT(UNIQUE(B2:B9))

    Removes duplicates, then sorts.

  4. Example 4. Count of distinct values

    =COUNTA(UNIQUE(B2:B9))

    How many kinds of product there are. Here it is 4.

  5. Example 5. Two columns as a pair

    =UNIQUE(A2:B9)

    A row is a duplicate only if both branch and product match.

Common mistakes

FAQ

Is it case-sensitive?
The calculation on this page treats upper and lower case as the same value.
How is it different from Remove Duplicates?
Remove Duplicates on the Data tab deletes from the source. UNIQUE leaves the source alone, builds a new list and updates when the source changes.