• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Excel UNIQUE Function

You are here: Home / Excel Functions / Excel UNIQUE Function

The Excel UNIQUE function can extract a list of distinct values, or a list of values that only occur once, i.e. unique values. It can return a unique or distinct list from one column or from multiple columns.

Syntax: =UNIQUE(array, [by_col], [occurs_once])

array is the range or array you want the unique values returned from.

by_col is an optional logical value (TRUE/FALSE) and allows you to compare values by row (FALSE), or by column (TRUE).

occurs_once is also an optional logical value (TRUE/FALSE) and allows you to find the truly unique values, i.e. the values that only occur once (TRUE), or all distinct values (FALSE).  If you omit this argument, it will default to FALSE and return a distinct list.

Note: The UNIQUE function is part of the new Excel Dynamic Arrays family and at the time of writing, Dynamic Arrays are only available in Office 365 and are currently in beta on the Insiders channel. Excel 2019 will not have the Dynamic Array functions.

Excel UNIQUE Function Examples

Let’s say we want to find a list of distinct values from the Item column (C) in the table below:

Excel UNIQUE function example

We can write a simple UNIQUE formula like this:

=UNIQUE(C7:C21)

You can see the results in cells B26:B30 in the image below:

Excel UNIQUE function spills result

The Excel UNIQUE function ‘spills’ the results into the rows below. This is the new dynamic array behaviour that occurs when the final result of the formula returns multiple values.

Note: In the example above, I’ve omitted the by_col argument, which means it will default to FALSE and compare values by row. I’ve also omitted the occurs_once argument so it has defaulted to FALSE and returned a distinct list.

Extract a list of Unique Values

If you want to find a list of values that only occur once in a list, i.e. a list of truly unique values, the occurs_once argument is set to TRUE. In the example below, you can see ‘Support’ is the only unique value in the range A2:A9:

extract list of unique values

Extracting UNIQUE Rows of Values

In the example below, you can see there are whole rows containing duplicates. Setting the by_col and occurs_once arguments to FALSE we get a list of unique rows, as shown below:

extract unique rows of values

Referencing a Dynamic Array

Dynamic Arrays can be referenced using the spilled range operator, #, as shown in the example below where the COUNTA function references A19#:

referencing a dynamic array

The benefit of using the spilled range operator is that it automatically adjusts as the spilled area grows or contracts.

You can also use spilled range operators in the Name Manager, among other places, but you’ll want to make it an absolute reference like so:

use spilled range operator in name manager

Extracting a Distinct List in Earlier Versions of Excel

Extracting unique or distinct values from a list is a common requirement and in earlier versions of Excel you can either use an array formula, a PivotTable or Power Query, as described here.

Download the Workbook

Enter your email address below to download the sample workbook.

By submitting your email address you agree that we can email you our Excel newsletter.
Please enter a valid email address.

Download the Excel Workbook. Note: This is a .xlsx file please ensure your browser doesn't change the file extension on download.

Related Tutorials

Excel FILTER Function Filter cells based on criteria.
Excel RANDARRAY Function Returns an array of random numbers between 0 and 1.
Excel SEQUENCE Function Returns list of sequential numbers that increment as specified.
Excel SORT Function Sort cells or arrays in ascending or descending order.
Excel SORTBY Function Sort cells or arrays based on criteria.

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
 
  • About My Online Training Hub
  • Contact
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Copyright © 2023 · My Online Training Hub · All Rights Reserved

Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.

Download A Free Copy of 100 Excel Tips & Tricks

excel tips and tricks ebook

We respect your privacy. We won’t spam you.

x