Skip to main content
 

Excel UNIQUE Function

Author: Amanda Li Last Modified: 2024-10-09

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


Syntax

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


Arguments

  • 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.

Example

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:

=UNIQUE(B3:B16)

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(C3:J3,TRUE)

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

Kutools for Excel - Helps You To Stand Out From Crowd

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...


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.