
What does UNIQUE do in Excel?
The UNIQUE function returns a dynamic list of distinct items from a range, automatically updating when source values change. It does not delete duplicates from the source. It works in Excel for Microsoft 365, Excel 2021 and later supported versions.
UNIQUE syntax
=UNIQUE(array,[by_col],[exactly_once])
The array is your source range. By default, UNIQUE compares rows. Set by_col to TRUE for columns. Set exactly_once to TRUE to return only items that occur precisely once.
Example 1: Get a distinct department list
Suppose A2:A7 contains Sales, HR, Sales, IT, HR, Finance.
=UNIQUE(A2:A7)
Result: Sales, HR, IT and Finance. Results spill into separate cells in order of first appearance.
Example 2: Sort the distinct results
=SORT(UNIQUE(A2:A7))
Result: Finance, HR, IT, Sales. SORT makes a unique list easier to scan.
Example 3: Find values appearing exactly once
=UNIQUE(A2:A7,,TRUE)
Result: IT and Finance. Sales and HR are excluded entirely because they each occur twice.
Example 4: Deduplicate entire records
Suppose A2:B6 contains Region and Product pairs, including West/Laptop twice:
=UNIQUE(A2:B6)
UNIQUE returns the distinct row combinations, rather than unique values separately from each column.
Example 5: Ignore empty source cells
=UNIQUE(FILTER(A2:A100,A2:A100<>""))
The FILTER step removes blank values. If nothing qualifies, FILTER may return #CALC!, so ensure the source has data or handle a no-results case.
Example 6: Count distinct nonblank entries
=ROWS(UNIQUE(FILTER(A2:A100,A2:A100<>"")))
This returns the number of distinct nonblank departments or products. Rows in the UNIQUE result determine the count.
Example 7: Unique products for one region
Regions are in A2:A100, product names in B2:B100 and the selected region in E2:
=SORT(UNIQUE(FILTER(B2:B100,A2:A100=E2)))
Only products from the selected region are included. When there are no matching rows, FILTER produces #CALC! unless you supply a no-result value.
UNIQUE vs Remove Duplicates
UNIQUE produces a separate formula-driven list; the Data tab’s Remove Duplicates command removes duplicate rows from a selected data set as a one-time operation.
Common errors
- #SPILL!: clear cells that block the output range.
- #NAME?: your Excel version may not support UNIQUE.
- Extra blanks: filter blank cells before applying UNIQUE.
- Unexpected duplicates: check spaces and inconsistent imported text types.
- Wrong exactly_once logic: TRUE returns only items that occur exactly once, not one example of each.
FAQs
Does UNIQUE remove original duplicate records?
No. It returns a separate result without modifying the source range.
Can UNIQUE sort output?
Wrap it with SORT, such as =SORT(UNIQUE(A2:A100)).
Does UNIQUE work in Excel 2019?
Not in standalone Excel 2019; consider Remove Duplicates or Power Query.
Practice exercise
Enter ten department names with repeats. Find distinct departments, sort the list and then find departments appearing exactly once.
Related tutorials
Browse Excel Functions for more worked examples and useful formulas.
Official reference
Check Microsoft Excel Support for function syntax and availability.
