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
Example 1. Product list
=UNIQUE(B2:B9)Returns 4 products: Apple, Milk, Bread and Coffee.
Example 2. Products sold only once
=UNIQUE(B2:B9, FALSE, TRUE)Only Coffee, which appears once.
Example 3. Sorted list
=SORT(UNIQUE(B2:B9))Removes duplicates, then sorts.
Example 4. Count of distinct values
=COUNTA(UNIQUE(B2:B9))How many kinds of product there are. Here it is 4.
Example 5. Two columns as a pair
=UNIQUE(A2:B9)A row is a duplicate only if both branch and product match.
Common mistakes
Including the header
If the array includes the header row, a header such as "Product" ends up in the list.
Blank cells show as 0
A blank cell in the range adds a 0 to the result. Filter blanks out first: =UNIQUE(FILTER(B2:B20, B2:B20<>"")).
Mistaking exactly_once for removing duplicates
TRUE does not mean "keep one of each"; it means "drop every duplicated value". If every value appears more than once, nothing is left and you get #CALC!.
The spill range is blocked
If cells the result would spill into already hold values, you get #SPILL!.
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.