Example 1
A list of the regions in the log
E2 =UNIQUE(B2:B10)
Result: North; South; East; West; Central
Nine orders, five different regions, in the order each first appears.
E2 =UNIQUE(B2:B10) returns North; South; East; West; Central
Returns each distinct value or row of a range once, in the order it first appears.
Syntax
=UNIQUE(, , )
Excel for Microsoft 365, Excel 2021 and later, and Excel for the web. Not available in Excel 2019 or earlier.
Try it
Edit the formula in E2 or change the inputs. The sheet recalculates as you type.
E2 =UNIQUE(B2:B10) returns North; South; East; West; Central
UNIQUE builds a list of the distinct items in a column: the regions in a sales log, the customers who ordered, the departments in a payroll export. It does what the Remove Duplicates button does, but without changing your data, and the list updates when the source does.
=UNIQUE(B2:C10) returns every different region and product pair.FALSE you ask: which values are there? With TRUE you ask: which values appear only once? Use it to find one-off customers or unmatched entries. Setting it to TRUE isn't a way of getting a normal distinct list.The results come back in order of first appearance. Wrap UNIQUE in SORT for an alphabetical list: =SORT(UNIQUE(B2:B10)).
UNIQUE with COUNTA or ROWS counts how many different values there are. =COUNTA(UNIQUE(B2:B10)) returns 5 for the data below. If part of the list is blank, count with ROWS(UNIQUE(FILTER(B2:B10,B2:B10<>""))) so the blank isn't counted.
The list spills down from the cell you typed in. To use the whole list in another formula, add # to the anchor cell. If E2 holds =UNIQUE(B2:B10), then =COUNTA(E2#) counts its items however many there are today. See FILTER for more on spill ranges and #SPILL!.
Text comparison ignores case, so "north" and "North" are the same item. Spaces count: "North" and "North " (with a trailing space) are different. If the list contains near-duplicates, clean the source with TRIM first: =UNIQUE(TRIM(B2:B10)).
A blank cell in the source comes back as 0 in the list. Filter blanks out first if that matters.
UNIQUE needs Microsoft 365, Excel 2021 or later, or Excel for the web. In earlier versions, use Data > Remove Duplicates on a copy of the data, or a PivotTable.
FALSE, the default, compares rows. TRUE compares columns, for data that runs across a sheet.FALSE, the default, returns every distinct item once. TRUE returns only items that appear a single time in the data, and drops anything that is repeated. If none qualify, the result is #CALC!.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
E2 =UNIQUE(B2:B10)
Result: North; South; East; West; Central
Nine orders, five different regions, in the order each first appears.
E2 =UNIQUE(B2:B10) returns North; South; East; West; Central
Example 2
E2 =UNIQUE(B2:B10,,TRUE)
Result: West; Central
North, South and East each appear more than once, so they are dropped. West and Central appear exactly once. The empty second argument keeps the default of comparing rows.
E2 =UNIQUE(B2:B10,,TRUE) returns West; Central
Example 3
E2 =UNIQUE(B2:C10)
Result: North, Gloves; South, Gloves; North, Tape; East, Gloves; East, Tape; West, Gloves; Central, Tape
A row is a duplicate only if both columns match an earlier row. The nine orders reduce to seven region and product pairs.
E2 =UNIQUE(B2:C10) returns North, Gloves; South, Gloves; North, Tape; East, Gloves; East, Tape; West, Gloves; Central, Tape
Example 4
E2 =SORT(UNIQUE(B2:B10))
Result: Central; East; North; South; West
UNIQUE returns the regions in the order they first appear. SORT puts them in alphabetical order.
E2 =SORT(UNIQUE(B2:B10)) returns Central; East; North; South; West
Example 5
G2 =COUNTA(E2#)
Result: 5
E2# is the whole list that the formula in E2 returns. If a new region appears in the log, the list grows and the count follows.
G2 =COUNTA(E2#) returns 5
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 3
In D2, list each ticket category once.
Answer in D2.
TRIM over the source with =UNIQUE(TRIM(B2:B10)).TRUE returns only items that occur once, and #CALC! when there are none. Leave it out for a normal distinct list.=UNIQUE(FILTER(B2:B10,B2:B10<>"")).array and the header is treated as a value. Start the range on the first data row.Use `=COUNTA(UNIQUE(B2:B10))`, or `=ROWS(UNIQUE(B2:B10))`. If the range can contain blanks, filter them out inside UNIQUE so they are not counted as a value.
With `TRUE`, UNIQUE returns only the items that appear exactly once in the data. Items that appear twice or more are left out completely. It is not the same as a distinct list.
No. "north" and "North" are treated as the same value. To compare with case, you need a different approach, such as testing with EXACT.
No. Values come back in order of first appearance. Use `=SORT(UNIQUE(range))` for alphabetical order.
It returned an empty result. That happens with `exactly_once` set to TRUE when every value is repeated, or when the source range is empty.
Remove Duplicates deletes rows from your data once. UNIQUE leaves the data alone and returns a live list that changes when the source does.
UNIQUE is taught in Data analysis with formulas, lesson 12: UNIQUE: lists and distinct counts. Each lesson is a short, graded exercise like the one above.