formulastreak

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

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.

Monthly sales by region · edit G2 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultG2 = North
ABCDEFGH
1MonthRegionProductUnitsRevenueRegions
2Jan 2026NorthFern40$380.00North
3Jan 2026NorthMonstera12$408.00South
4Jan 2026SouthFern35$332.50
5Jan 2026SouthMonstera9$306.00
6Feb 2026NorthFern44$418.00
7Feb 2026NorthMonstera15$510.00
8Feb 2026SouthFern31$294.50
9Feb 2026SouthMonstera11$374.00
10Mar 2026NorthFern52$494.00
11Mar 2026NorthMonstera14$476.00
12Mar 2026SouthFern38$361.00
13Mar 2026SouthMonstera13$442.00
14Apr 2026NorthFern47$446.50
15Apr 2026NorthMonstera18$612.00
16Apr 2026SouthFern42$399.00
17Apr 2026SouthMonstera16$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. 1. UNIQUE: Lists each different value in B2:B17 once, 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

ArgumentRequiredWhat it is
arrayYesThe range to take distinct values from.
by_colNoTRUE compares columns instead of rows. FALSE (the default) compares rows.
exactly_onceNoTRUE 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

  • #SPILL!: Something blocks the cells the list needs.
  • #NAME?: The file is open in Excel 2019 or older.

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.

Practise UNIQUE on a live sheet

Lesson 39, UNIQUE and SORT (Unit 11, Dynamic arrays), has 6 graded exercises, checked instantly, with steps and hints when you're stuck. Pro