Unique
The Unique() function returns the distinct rows in a range, in the order in which they occur.
Syntax
Unique (Range)
Range | The range of cells in Excel used as input |
Note:
Input parameters can consist of Quintessence functions. This includes functions that return ranges in cases where a parameter value can be a range.
The output from this function is not ordered alphanumerically, but in the order in which it occurred in the input.
This function treats rows as single entities.
Examples
Example 1. Return the distinct numbers from a single column range
Example 2. Return the distinct countries from a single column range
Example 3. Return the distinct rows from a multiple column range
Example 1. Return the distinct numbers from a single column range
The input range consist of a list of numbers. The Unique() function outputs the distinct numbers in the range, in the order in which they occur. To return an ordered list, use SetUnion() with a single range as input.
Range | Unique elements |
8 | =Unique(A2:A7) |
4 | |
4 | |
1 | |
6 | |
4 |
Range | Output |
8 | 8 |
4 | 4 |
4 | 1 |
1 | 6 |
6 | |
4 |
Example 2. Return the distinct countries from a single column range
The input range consists of a list of countries. The Unique() function is used to output the distinct countries in the range, in the order in which they occur.
Range | Unique countries |
India | =Unique(A2:A8) |
Japan | |
Brazil | |
China | |
Japan | |
Japan | |
India |
Range | Output |
India | India |
Japan | Japan |
Brazil | Brazil |
China | China |
Japan | |
Japan | |
India |
Example 3. Return the distinct rows from a multiple column range
A range consists of multiple columns. The Unique() function is used to determine the distinct rows in the range.
Range | Unique | ||
CEB | PHO | =Unique(A2:C7) | |
CEB | PHO | CEB | |
VRR | VRR | ||
KVJ | CEB | ||
KVJ | CEB | ||
VRR | VRR |
Range | Output | ||||
CEB | PHO | CEB | PHO | ||
CEB | PHO | CEB | CEB | PHO | CEB |
VRR | VRR | VRR | VRR | ||
KVJ | CEB | KVJ | CEB | ||
KVJ | CEB | ||||
VRR | VRR |