Dynamic arrays function
UNIQUE function in Google Sheets and Excel
UNIQUE returns each distinct value of a range once, spilled into the cells below.
Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
Syntax
UNIQUE(array, [by_col], [exactly_once])Arguments in [brackets] are optional. Google Sheets writes it UNIQUE(range, by_column, exactly_once).
Example
=UNIQUE(B2:B17) reads: List each region in B2:B17 once.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Month | Region | Product | Units | Revenue | Regions | ||
| 2 | Jan 2026 | North | Fern | 40 | $380.00 | North | ||
| 3 | Jan 2026 | North | Monstera | 12 | $408.00 | South | ||
| 4 | Jan 2026 | South | Fern | 35 | $332.50 | |||
| 5 | Jan 2026 | South | Monstera | 9 | $306.00 | |||
| 6 | Feb 2026 | North | Fern | 44 | $418.00 | |||
| 7 | Feb 2026 | North | Monstera | 15 | $510.00 | |||
| 8 | Feb 2026 | South | Fern | 31 | $294.50 | |||
| 9 | Feb 2026 | South | Monstera | 11 | $374.00 | |||
| 10 | Mar 2026 | North | Fern | 52 | $494.00 | |||
| 11 | Mar 2026 | North | Monstera | 14 | $476.00 | |||
| 12 | Mar 2026 | South | Fern | 38 | $361.00 | |||
| 13 | Mar 2026 | South | Monstera | 13 | $442.00 | |||
| 14 | Apr 2026 | North | Fern | 47 | $446.50 | |||
| 15 | Apr 2026 | North | Monstera | 18 | $612.00 | |||
| 16 | Apr 2026 | South | Fern | 42 | $399.00 | |||
| 17 | Apr 2026 | South | Monstera | 16 | $544.00 |
G2 and G3 show North and South: the two regions, once each.
How the spreadsheet calculates it
Lists each different value in B2:B17 once, and spills the list.
- 1. UNIQUE: Lists each different value in
B2:B17once, and spills the list.range=`B2:B17`: the column to de-duplicate
More UNIQUE examples
=UNIQUE(B2:B17)Each region once.=SORT(UNIQUE(C2:C17))Each product once, alphabetically.=COUNTA(UNIQUE(B2:B17))How many different regions there are.=UNIQUE(A2:A11,FALSE,TRUE)Only the values that appear exactly once.
Paste any of these into the formula explainer to see it step by step.
Tips
- Wrap the range in FILTER to drop blanks first:
UNIQUE(FILTER(A2:A100, A2:A100<>"")). - Wrap it in SORT for an alphabetical list.
- Refer to the whole result with the spill reference (
G2#) in other formulas, so they grow with it. - Clean the text first with TRIM: “North” and “North ” count as different values.
What UNIQUE is used for
Building the list of categories, regions or customers for a summary table, feeding a dropdown, and counting distinct values.
Arguments
| Argument | Required | What it is |
|---|---|---|
| array | Yes | The range to take distinct values from. |
| by_col | No | TRUE compares columns instead of rows. FALSE (the default) compares rows. |
| exactly_once | No | TRUE returns only the values that appear exactly once. |
Common mistakes
Typing below the formula: the list needs room to spill.
Expecting a sorted list: wrap it in SORT.
Counting distinct values with COUNTA(UNIQUE(…)) when the range has blanks, which counts the blank as a value.
In Google Sheets
Google Sheets has UNIQUE too; compare Google's syntax line below for its optional arguments.
Errors you may see with UNIQUE
Questions
How do I count unique values?
COUNTA(UNIQUE(range)) in Excel 2021 or later; in any version, see count unique values.
Is UNIQUE case-sensitive?
Microsoft's page doesn't say, so we don't promise either way; wrap the range in LOWER to treat case alike on purpose.
Does UNIQUE update when the data changes?
Yes: it recalculates like any formula, so a new value in the source range appears in the list straight away (as long as there's room to spill).
Why does UNIQUE show #SPILL!?
Something is in the cells below the formula where the list needs to go. Clear them, or move the formula to an empty area. See the #SPILL! page.
Can UNIQUE work across several columns?
Yes: give it a range several columns wide and it returns each distinct row, comparing all columns together. Set by_col to TRUE to compare columns instead.
What works in older Excel?
Excel 2019 and older have no UNIQUE. Flag first occurrences with an expanding COUNTIF, COUNTIF($A$2:A2, A2)=1, as in find duplicates, or use Remove Duplicates on a copy.
Sources
Official documentation the facts on this page were checked against.