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(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.
The UNIQUE function returns an array.
- 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.
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:
Note: In the results row, UNIQUE returns the empty string (“”) itself and zero (0) for the blank cell.
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
Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings
powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save
time for you.
- Designed for
work scenarios, helps you solve
- Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
- Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
- 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
when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.