UNIQUE
Returns distinct rows or columns from a range.
UNIQUE preserves first-occurrence order and can optionally return only values that appear once.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=UNIQUE(array, [by_col], [exactly_once])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
array | range (range) | Required | — |
by_col | logical | Optional | false |
exactly_once | logical | Optional | false |
Remarks
- Defaults:
by_col=FALSE,exactly_once=FALSE. - With
by_col=FALSE, uniqueness is evaluated by full rows. - With
by_col=TRUE, uniqueness is evaluated by full columns. - With
exactly_once=TRUE, only entries with frequency 1 are returned. - Result spills as an array.
Examples
Return one entry for each distinct region.
Formula =UNIQUE({"East";"West";"East"})
Expected result {"East"; "West"}
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Return only names that occur exactly once.
Formula =UNIQUE({"East";"West";"East"},FALSE,TRUE)
Expected result West
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A single entry is its own unique result.
Formula =UNIQUE({"East"})
Expected result East
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A division-by-zero error propagates from the input.
Formula =UNIQUE(1/0)
Expected result #DIV/0!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Unique values by row
Formula =UNIQUE(A1:A4)
| A | |
|---|---|
| 1 | "A" |
| 2 | "A" |
| 3 | "B" |
| 4 | "C" |
Expected result {"A"; "B"; "C"}
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Only values that appear once
Formula =UNIQUE(A1:A4,FALSE,TRUE)
| A | |
|---|---|
| 1 | 1 |
| 2 | 1 |
| 3 | 2 |
| 4 | 3 |
Expected result {2; 3}
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
What does exactly_once=TRUE change?
Instead of returning first occurrences, UNIQUE returns only rows or columns whose full key appears exactly one time.
How does by_col affect uniqueness checks?
by_col=FALSE compares entire rows, while by_col=TRUE compares entire columns and spills unique columns.