Function · Dynamic arrays
Excel UNIQUE function
The Excel UNIQUE function returns distinct values and spills them. Austin, Dallas, Austin, Houston spills Austin, Dallas, Houston, in the order they first appear.
Syntax =UNIQUE(array, [by_col], [exactly_once])
=UNIQUE(A1:A4)Arguments
| Name | Required | What to pass |
|---|---|---|
| array | Required | The rows or columns to thin out. |
| by_col | Optional | FALSE, the default, compares rows. TRUE compares columns. |
| exactly_once | Optional | FALSE, the default, keeps one of each distinct value. TRUE keeps only values that appear a single time. |
Examples
Four city rows, one of them repeated
=UNIQUE(A1:A4)Result Austin, Dallas, and Houston
| A | B | |
|---|---|---|
| 1 | Austin | Austin |
| 2 | Dallas | Dallas |
| 3 | Austin | Houston |
| 4 | Houston |
UNIQUE keeps one copy of each distinct row and spills the result. Austin, Dallas, Austin, Houston becomes Austin, Dallas, Houston. Dallas does not jump ahead of Austin. The order is the order of first appearance, not alphabetical order. SORT does the alphabetical part.
The third argument changes the meaning. exactly_once TRUE throws away anything that appears more than once, so Austin disappears and only Dallas and Houston remain. The default FALSE is the distinct list. by_col TRUE is for a list written across a row instead of down a column. A blocked spill is #SPILL!. Excel 2019 does not have UNIQUE.