Skip to main content

Excel UNIQUE Function

The UNIQUE function extracts unique values from a range of data. The data can include text, numbers, dates, error values, etc.

Note: The UNIQUE function is only available in Excel for Microsoft 365, Excel 2021 or newer versions of Excel, and Excel for the web.

unique function 1


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


  • array (required): The range or array to retrieve unique values.
  • [by_col] (optional): A logical value indicating how to compare data:
    • TRUE, to compare data by columns;
    • FALSE or omitted, to compare data by rows.
  • [exactly_once] (optional): A logical value indicating how to define a unique value:
    • TRUE, to return all distinct rows or columns that occur exactly once from array;
    • FALSE or omitted, to return all distinct rows or columns from array.

Return Value

The UNIQUE function returns an array.

Function Notes

  • array can be supplied as a row of values, a column of values, or a combination of rows and columns of values.
  • The result returned by UNIQUE will spill into a range of cells in the way your original data of array is organized.
  • If you have zero (0) and a blank cell in array, UNIQUE will return two zeros: One represents an empty cell, and the other represents the zero itself. Note: A blank is also considered as a distinct value.
  • UNIQUE can be used between different workbooks. However, make sure the referenced workbooks are open. Otherwise, a #REF! error will be returned if you refresh the result cell.
  • The results of UNIQUE are dynamic, meaning that they update automatically when values in the source data change. However, the results will not be updated if you add new entries to array. To fix this, you should use structured references as array argument.


To extract the distinct values from the list as shown in the column B below, please copy or enter the formula below in the top cell of the result table and then press Enter to get the result:


Note: The by_col and exactly_once arguments are omitted because they default to compare the rows against each other and return all the different values in the array.

unique function 2

Example to Retrieve Unique Values in a Row

To extract unique values from the data in the row C as shown below, please copy or enter the formula below in the left-most cell of the result table and then press Enter to get the result:


unique function 3

Note: In the results row, UNIQUE returns the empty string (“”) itself and zero (0) for the blank cell.

Related functions

Excel FILTER Function

The FILTER function filters a range of data and dynamically returns the matching results according to the criteria you specify.

Excel SORT Function

The SORT function sorts the contents of a range or array in ascending or descending order.

Excel SORTBY Function

The SORTBY function sorts the contents of one range or array based on the values in a corresponding range or array, no matter the corresponding range or array is included in the range or array to be sorted or not.

The Best Office Productivity Tools

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations