Practice free

UNIQUE function

UNIQUE returns a list with duplicates removed. It is a quick way to get a list of categories, customers or IDs, and the comparison is not case-sensitive.

Example

Read it as a sentence: list each Category in C2:C7 once and show the first one, which gives Tools.

Practice this in the app

Syntax

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

Arguments in [square brackets] are optional.

array (required)
Range or array to deduplicate.
by_col (optional)
TRUE to compare columns instead of rows.
exactly_once (optional)
TRUE to return only items that appear once.

Returns: The distinct values or rows.

One UNIQUE formula can fill more than one cell. When the result has several values, they spill into the cells below or to the right of the formula.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=UNIQUE({"a";"A";"b"}) a Case-insensitive?
=UNIQUE({1,1,2}) 1 Row, default by_col
=UNIQUE({1,1,2},TRUE) 1 by_col
=UNIQUE({1;"1"}) 1 Number vs text
=UNIQUE(Items!C2:C7) Tools Distinct
=UNIQUE(Items!C2:C7,,TRUE) Tools Exactly once
=UNIQUE({"a";"a"},,TRUE) #CALC! Nothing occurs once
=UNIQUE(Items!C2:C7) #SPILL! Spill blocked

The Items sheet these formulas read

Watch out for

  • Comparison is not case-sensitive in Excel.
  • exactly_once returns items occurring only once, not distinct items.
  • Blanks count as a value and appear as 0.

Where it works

Excel
UNIQUE arrived in Excel 2021. Older versions do not have it.
Google Sheets
Same name, but behaves differently. Sheets UNIQUE(range, [by_col], [exactly_once]) is similar, but Sheets text comparison is case-sensitive by default.

Part of Lookup and reference functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .