ShareYourGroupShareYourGroupExcel Formulas

Dynamic arrays functions

UNIQUE function in Excel

UNIQUE returns the different values in a range, with each one listed once.

A column of data repeats the same values many times: the same customers, the same products, the same cities. UNIQUE boils it down to one of each. It is available in Excel 2021 and Microsoft 365.

Syntax

=UNIQUE(array, [by_col], [exactly_once])
ArgumentWhat it is
arrayThe range to take values from.
by_colTRUE to compare columns. Leave it out to compare rows.
exactly_onceTRUE to return only the values that appear exactly once. FALSE or left out returns every different value once.

Examples

Each result below is what Excel itself showed for the formula on the sample sheet.

Sample sheet: Twelve sales made by four salespeople in three regions.
ABCDEF
1DateSalespersonRegionProductUnitsAmount
205-Jan-2026AshaNorthNotebook201200
312-Jan-2026RaviSouthPen50500
420-Jan-2026MeenaNorthBag43000
502-Feb-2026AshaEastPen30300
614-Feb-2026KabirSouthNotebook15900
728-Feb-2026RaviNorthBag21500
803-Mar-2026MeenaEastNotebook402400
915-Mar-2026AshaNorthBag32250
1022-Mar-2026KabirSouthPen60600
1101-Apr-2026RaviEastNotebook251500
1218-Apr-2026MeenaNorthPen80800
1306-May-2026AshaSouthBag53750

How it works

UNIQUE reads down the range and returns each different value the first time it meets it. The result spills into the cells below the formula. The order is the order of first appearance. Wrap it in SORT for alphabetical order.

The list is live. Add a row with a new salesperson and the name appears in the list at once. The Remove Duplicates command on the Data tab, by contrast, deletes rows from your actual data and has to be run again each time.

Distinct or truly unique?

The third argument changes the question.

The second form finds one-time customers, or entries with no duplicate. In the sample every salesperson has several sales, so the sixth example returns nothing and shows #CALC!.

Several columns

Give UNIQUE a range of two or more columns and it compares whole rows. =UNIQUE(C2:D13) lists each combination of region and product that occurs. Rows are treated as the same only when every column matches.

Counting different values

"How many different customers bought something?" is =COUNTA(UNIQUE(range)). If the range may contain empty cells, filter them out first, or the blank is counted as a value: =COUNTA(UNIQUE(FILTER(range, range<>""))).

Building a summary table

UNIQUE and SUMIF together make a report with two formulas.

  1. In H2: =UNIQUE(B2:B13) lists the salespeople.
  2. In I2: =SUMIF(B2:B13, H2#, F2:F13) gives each one's total.

H2# means "the whole list that H2 spilled", so the second formula returns a total for every name and grows when a new name arrives. The same pattern works with COUNTIF and AVERAGEIF.

A drop-down list that updates itself

Put =SORT(UNIQUE(range)) in a spare column. In Data Validation, choose List and give the source as the first cell followed by a hash, such as =$H$2#. The drop-down then always offers the current set of values.

How values are compared

Common mistakes

In Google Sheets

UNIQUE exists in Google Sheets with the same three arguments.

Related functions

Every result on this page was calculated in Microsoft Excel (version 16.0, build 20326) on 12 November 2026, not typed by hand.

This is an independent help site. It is not connected with or approved by Microsoft. Excel and Microsoft 365 are trademarks of Microsoft Corporation, named here only to say which program a formula is for. The people and figures in the sample sheets are made up.