WorkbookLogic
FunctionDynamic arraysadvancedUNIQUEIFAND

UNIQUE Function

By WorkbookLogic

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.

ExcelLast reviewed Sep 11, 2026
unique-function-v1.0.0.xlsx
Excel UNIQUE Function
UNIQUE returns distinct or exactly-once values as a dynamic spilled array.
Source data, editableDynamic results
RegionStatusExampleFormula syntaxRegionStatus
NorthOpenDistinct regions=UNIQUE(A12:A18)North
SouthClosedSouth
NorthOpenEast
EastPending
SouthOpenDistinct records=UNIQUE(A12:B18)NorthOpen
NorthClosedSouthClosed
SouthClosedEastPending
SouthOpen
NorthClosed
Exactly once=UNIQUE(A12:A18,,TRUE)East
Reliability checks
Distinct regions preserve North, South, East orderOK
East is the only region appearing exactly onceOK

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, or FILTER

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 #SPILL!.

Closed external source

Linked dynamic arrays may return #REF!.

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.