How to Count Unique Values in Excel 365 – UNIQUE Function

The Excel UNIQUE function returns a list of unique values in a list or range. Values can be text, numbers, dates, times, etc.

Extract unique values from range Return value Array of unique values Syntax =UNIQUE (array, [by_col], [exactly_once])Arguments 

  • array – Range or array from which to extract unique values.
  • by_col – [optional] How to compare and extract. By row = FALSE (default); by column = TRUE.
  • exactly_once – [optional] TRUE = values that occur once, FALSE= all unique values (default).

The Excel UNIQUE function extracts a list of unique values from a range or array. The result is a dynamic array of unique values. If this array is the final result (i.e. not handed off to another function), array values will “spill” onto the worksheet into a range that automatically updates when new uniques values are added or removed from the source range.


To return unique values from in the range A1:A10, you can use a formula like this:


To return unique values from the horizontal range A1:E1, set the by_col argument to TRUE or 1:

=UNIQUE(A1:E1,1) // extract unique from horizontal array

The UNIQUE function has an optional argument called exactly_once that controls how the function deals with repeating values. By default, exactly_once is FALSE. This means UNIQUE will extract unique values regardless of how many times they appear in the source data. If set to TRUE or 1, UNIQUE will extract only unique values that appear just once in the source data:

=UNIQUE(A1:A10,0,1) // values that appear once only

UNIQUE is a new function available in Excel 365 only. if you are using Excel 2013 or older, please see below.