The UNIQUE function takes three arguments: array, by_col, and exactly_once. The first argument, array, is the array or range from which to extract unique values. This is the only required argument. The second argument, by_col, controls whether UNIQUE will extract unique values by rows or by columns. By default, UNIQUE will extract unique values in rows. To force UNIQUE to extract unique values by columns, set by_col to TRUE or 1. The last argument, exactly_once, sets behavior for values that appear more than once. By default, UNIQUE will extract all unique values, regardless of how many times they appear in array. To extract unique values that appear only once in array, set exactly_once to TRUE or 1. Note: the UNIQUE function is not case-sensitive. UNIQUE will treat “APPLE”, “Apple”, and “apple” as the same text.
Basic example
The UNIQUE function extracts unique values from a range or array: To return unique values from in the range A1:A10, you can use a formula like this:
By column
By default, UNIQUE will extract unique values in rows: UNIQUE will not handle the same values organized in columns: To handle the horizontal array above, set the set the by_col argument to TRUE or 1: To return unique values from the horizontal range A1:E1, set the by_col argument to TRUE or 1:
Exactly once
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: Set exactly_once to TRUE or 1 to extract unique values that appear just once in the source data: Notice the above formula also sets the by_col argument to zero (0), the default value. The same formula could also be written like this:
Unique with criteria
To extract unique values that meet specific criteria, you can use UNIQUE together with the FILTER function. The generic formula, where rng2=A1 represents a logical test, looks like this: For more details, see the complete explanation here.
Dave Bruns
Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.