UNIQUE
Return a list of distinct values from a range or array, removing duplicates automatically.
Spreadsheet editor
Spreadsheet editor
Syntax
=UNIQUE(array, [by_col], [exactly_once])
Returns: Array Arguments
| Argument | Required | Description |
|---|---|---|
| array | Yes | The range or array from which to return unique rows or columns. |
| by_col | No | A logical value that sets the comparison direction. TRUE compares columns. FALSE or omitted compares rows. |
| exactly_once | No | A logical value that controls filtering. TRUE returns only values that appear exactly once. FALSE or omitted returns all distinct values. |
About
By default UNIQUE compares rows, but you can set by_col to TRUE to compare columns instead. There is also an exactly_once option: set it to TRUE to return only values that appear a single time in your data, which is handy for spotting one-off entries.
UNIQUE pairs well with other dynamic array functions. Wrap it in SORT to get an alphabetized list, pass it to FILTER to narrow results further, or feed it into COUNTIF to count how often each distinct value appears.
Exercises using UNIQUE
Get unique values with UNIQUE
BeginnerUse UNIQUE to return a deduplicated customer list from a transaction log.
Open exerciseUNIQUE with SORT for a department list
IntermediateCombine UNIQUE and SORT to create a clean, alphabetized list of distinct department names for a reporting summary.
Open exerciseExamples
Find products ordered only once
Spreadsheet editor
Unique name-city pairs across columns
Spreadsheet editor
Sorted unique list of expense categories
Spreadsheet editor
Watch out for
#SPILL! error from blocked cells
The cells where UNIQUE needs to spill its results already contain data, so Excel returns a #SPILL! error.
→ Clear the cells below (or beside) the formula so the dynamic array has room to expand.
Forgetting the exactly_once argument
You expect only values that appear once, but UNIQUE returns all distinct values by default.
→ Set the third argument to TRUE: =UNIQUE(A2:A50, FALSE, TRUE). This filters the list to entries that occur exactly one time.
Case sensitivity surprises
UNIQUE treats "Apple" and "apple" as the same value because it is not case-sensitive by default.
→ If you need case-sensitive comparison, combine UNIQUE with EXACT or clean your data first so casing is consistent.