Note: The other languages of the website are Google-translated. Back to English

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


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

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings

300
 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save
80%
time for you.

  • Designed for
    1500
    work scenarios, helps you solve
    80%
     Excel problems.
  • 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.
  • 30
    -day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

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, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations

Follow Us

Copyright © 2009 - www.extendoffice.com. | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL