UNIQUE Function
UNIQUE returns the distinct values or rows from a range as a dynamic array. It is useful for self-updating lists, filters, and exception reports.
| Excel UNIQUE Function | |||||||||||
| UNIQUE returns distinct or exactly-once values as a dynamic spilled array. | |||||||||||
| Source data, editable | Dynamic results | ||||||||||
| Region | Status | Example | Formula syntax | Region | Status | ||||||
| North | Open | Distinct regions | =UNIQUE(A12:A18) | North | |||||||
| South | Closed | South | |||||||||
| North | Open | East | |||||||||
| East | Pending | ||||||||||
| South | Open | Distinct records | =UNIQUE(A12:B18) | North | Open | ||||||
| North | Closed | South | Closed | ||||||||
| South | Closed | East | Pending | ||||||||
| South | Open | ||||||||||
| North | Closed | ||||||||||
| Exactly once | =UNIQUE(A12:A18,,TRUE) | East | |||||||||
| Reliability checks | |||||||||||
| Distinct regions preserve North, South, East order | OK | ||||||||||
| East is the only region appearing exactly once | OK | ||||||||||
Overview
UNIQUE returns a distinct, automatically resizing list from source data.
Quick reference
Syntax: =UNIQUE(array, [by_col], [exactly_once])
Returns: A spilling array of distinct values or records. (dynamic array)
Arguments:
array(required) — The range or array to evaluate.by_col(optional) — TRUE compares columns; FALSE or omitted compares rows.exactly_once(optional) — TRUE returns only values occurring exactly once.
Only the source array is required. By default, UNIQUE compares rows and returns one instance of each distinct record; optional arguments compare columns or return values occurring exactly once.
Common uses
- Building self-updating validation lists
- Counting or reviewing distinct customers, products, or regions
- Creating summary inputs for
COUNTIF,SUMIF, orFILTER
When not to use it
Use a PivotTable or grouped query when distinct values also need aggregation, refresh controls, or a persistent reporting layout. UNIQUE returns the distinct array only.
Calculations
Excel scans the supplied array, keeps the first occurrence of each distinct item or row, and spills the result into neighboring cells. The spill range expands or contracts when the source changes. Multi-column arrays are compared as complete rows unless by_col is TRUE.
Function behavior
Situation | Behavior |
|---|---|
Blank cells | A blank may appear as a distinct result. |
Text comparison | Matching is not case-sensitive. |
Blocked spill range | Excel returns |
Closed external source | Linked dynamic arrays may return |
Common errors
Leaving cells in the spill area
What happens: Excel returns #SPILL!.
Better approach: Clear the intended output area or move the formula.
Expecting only single-occurrence values
What happens: The default removes duplicates but still returns one copy.
Better approach: Set exactly_once to TRUE.
Example
Example 1 — Distinct regions
=UNIQUE(A12:A18)
In the workbook this returns North, South, and East.
Example 2 — Distinct records
=UNIQUE(A12:B18)
Both columns define uniqueness, producing five distinct region-and-product records.
Example 3 — Values appearing exactly once
=UNIQUE(A12:A18,,TRUE)
This returns East because it is the only region occurring once.
Example workbook
The workbook demonstrates distinct values, distinct multi-column records, exactly-once behavior, live spill ranges, and automated checks.
Key takeaway
Use UNIQUE when the output list should stay distinct and resize automatically with its source.