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.

Microsoft 365, Excel 2021, Excel 2024, and Excel for the web. Also in Google Sheets.

Syntax =UNIQUE(array, [by_col], [exactly_once])

UNIQUE
=UNIQUE(A1:A4)

Arguments

NameRequiredWhat to pass
arrayRequiredThe rows or columns to thin out.
by_colOptionalFALSE, the default, compares rows. TRUE compares columns.
exactly_onceOptionalFALSE, 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

=UNIQUE(A1:A4)B1
Cities
AB
1AustinAustin
2DallasDallas
3AustinHouston
4Houston
A picture of the sheet, not a live calculator. B1 holds the formula. B2 and B3 are the spill. The order is first appearance, not alphabetical.

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.