Syntax
=UNIQUE(array, [by_col], [exactly_once])Arguments
| Argument | Required | Description |
|---|---|---|
array | Required | The range or array |
by_col | Optional | FALSE (default) compares rows, TRUE compares columns |
exactly_once | Optional | TRUE returns only the values that appear exactly once |
How to use UNIQUE
When UNIQUE returns more than one value, the result spills into the cells below and to the right. Keep those cells empty, or you get #SPILL!.
UNIQUE takes 1 required argument and 2 optional arguments. Type =UNIQUE( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.
Examples
Each result below was calculated by the SheetsBat formula engine.
=UNIQUE({1;2;1;3})Result Spilled result
| A | |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
=UNIQUE({"a";"A";"b"})Result Spilled result
| A | |
|---|---|
| 1 | a |
| 2 | b |
=UNIQUE({1;2;1}, FALSE, TRUE)Result Related array functions
- SORTBYSorts a range or array by the values of other ranges or arrays.
- SORTNReturns the first n rows of a range after sorting, with options for ties.
- TAKEReturns a number of rows or columns from the start (positive) or end (negative) of an array.
- TOCOLReturns the values of an array as a single column.
- TOROWReturns the values of an array as a single row.
- TRIMRANGERemoves empty rows and columns from the edges of a range.
- VSTACKStacks arrays on top of each other; shorter rows are padded with #N/A.
- WRAPCOLSWraps a row or column of values into columns of the given length.
- WRAPROWSWraps a row or column of values into rows of the given length.