Get Unique Values From a Column in Excel With UNIQUE
To create a unique list in Excel, use =UNIQUE(A2:A9). It works in Excel and Google Sheets, spilling distinct values into the cells below the formula without changing the source data. The source remains available for checking the result.
On this page▾
- UNIQUE syntax: how to get unique values from a range
- How do you pull all unique values from a column in Excel?
- Order of the results
- How does UNIQUE compare rows and columns?
- Why does UNIQUE still show duplicates?
- Give the result room to spill
- Building a list that updates itself
- Worked example: compare the color grid by columns
- Where it fits
- Frequently asked questions
- Why does UNIQUE show #SPILL! in Excel?
- What is the difference between an Excel distinct list and exactly-once values?
- What to check when a list changes
| Goal | Formula for the example | Result |
|---|---|---|
| One copy of each name | =UNIQUE(A2:A9) |
5 names |
| Names occurring once | =UNIQUE(A2:A9,FALSE,TRUE) |
3 names |
| Alphabetical distinct list | =SORT(UNIQUE(A2:A9)) |
5 sorted names |
UNIQUE syntax: how to get unique values from a range
Excel's syntax is =UNIQUE(array, [by_col], [exactly_once]). Google Sheets uses UNIQUE(range, by_column, exactly_once). The two optional arguments mean the same in both apps:
- by_col / by_column: FALSE or omitted compares rows against each other. TRUE compares columns.
- exactly_once: FALSE or omitted returns every distinct entry. TRUE returns only entries that occur exactly once.
That second option is easy to misread. Microsoft calls it "the database concept of unique." Distinct means "one copy of each." Exactly once means "values that were never repeated."
How do you pull all unique values from a column in Excel?
Suppose A2:A9 holds these eight customer names from a service log:
| Row | Customer |
|---|---|
| 2 | Ana |
| 3 | Ben |
| 4 | Ana |
| 5 | Cho |
| 6 | Dee |
| 7 | Ben |
| 8 | Ana |
| 9 | Eli |
=UNIQUE(A2:A9) returns five names: Ana, Ben, Cho, Dee, Eli. Ana appears three times and Ben twice, but each is listed once.
=UNIQUE(A2:A9, FALSE, TRUE) returns three names: Cho, Dee, Eli. Ana and Ben are gone because they occur more than once.
The counts check out: 8 entries minus Ana's 3 and Ben's 2 leaves 3 entries that occur only once, and those three names plus Ana and Ben make 5 distinct values.
Order of the results
Google states that rows come back in the order they first appear in the source range. In the example that is Ana, Ben, Cho, Dee, Eli. For an alphabetical list in Excel, Microsoft shows nesting it inside SORT: =SORT(UNIQUE(A2:A9)).
How does UNIQUE compare rows and columns?
UNIQUE compares whole rows when given several columns. Consider this grid of colors in B2:D5:
| Color 1 | Color 2 | Color 3 |
|---|---|---|
| Red | Yellow | Red |
| Blue | Magenta | Blue |
| Red | Yellow | Red |
| Green | White | Green |
=UNIQUE(B2:D5) returns three rows, because rows 1 and 3 are identical. =UNIQUE(B2:D5, FALSE, TRUE) returns two rows (Blue, Magenta, Blue and Green, White, Green), since the Red-Yellow-Red row occurs twice and is excluded. Setting by_column to TRUE flips the comparison and checks columns against each other instead.
This means a row counts as a duplicate only when every cell in the selected columns matches. If you pick only the Customer column, two different sales to the same customer collapse into one. Select the columns that together define a duplicate.
Why does UNIQUE still show duplicates?
If rows come back that look identical, check for hidden differences: text cells with trailing spaces, or numbers formatted differently (percentages in one cell, plain decimals in another). "Ana" and "Ana " are different values to the formula even though they look the same on screen.
The fix is to clean the source first, for example with TRIM in a helper column, then run UNIQUE on the cleaned column.
Give the result room to spill
Enter =UNIQUE(A2:A9) in C2, leaving C2:C6 available for the five names in this example. Press Enter once; do not type a separate formula in every output cell. In Excel, only the top-left cell of a spilled array is editable. To change the source range or an argument, edit C2 rather than a later result cell.
If existing content blocks the output, Excel returns #SPILL!. Move the obstructing content elsewhere if you need to keep it, then let the formula recalculate. The five-name result needs five cells.
Building a list that updates itself
Because UNIQUE is a formula, new rows flow through. Microsoft notes that if your data is an Excel table and you reference it with structured references, the result resizes automatically when rows are added or removed. A plain range will not grow on its own, so extend the reference when you add data below it. For example, if your table is named ServiceLog and its column is Customer, put =UNIQUE(ServiceLog[Customer]) in a worksheet cell outside the table. The table is the expanding source, not the place to put the spilled output: spilled array formulas are not supported inside Excel tables.
Excel adds a limit: dynamic arrays between workbooks only work when both files are open. If you close the source workbook, linked formulas return #REF! when refreshed.
Worked example: compare the color grid by columns
In the B2:D5 color grid above, columns B and D both contain Red, Blue, Red, Green. Column C contains Yellow, Magenta, Yellow, White. Therefore =UNIQUE(B2:D5,TRUE) returns two columns, not three rows: one copy of B/D and one copy of C, still with four rows each.
The default =UNIQUE(B2:D5) instead compares the four whole rows and returns three rows by three columns. Changing the second argument changes what counts as an entry; it does not merely turn a vertical name list sideways.
Where it fits
Use UNIQUE when you want a clean list of categories, clients, or SKUs for a dropdown, a summary tab, or a count. Delete duplicates in place only when you are sure you want the extra rows gone for good; removing duplicates and extra spaces covers that route.
Frequently asked questions
Why does UNIQUE show #SPILL! in Excel?
One cause is content blocking the intended output range. Place the formula outside the source table, leave the neighboring result cells free, and move any blocking content you need to keep. Edit only the top-left formula cell. These are Excel spill checks, not Google Sheets error-message instructions.
What is the difference between an Excel distinct list and exactly-once values?
The default returns one copy of each distinct value. Setting exactly_once to TRUE returns only entries that occur once, so =UNIQUE(A2:A9,FALSE,TRUE) excludes every repeated name.
What to check when a list changes
Check the source range, the comparison direction and the exactly-once argument before interpreting a result. A fixed A2:A9 reference does not include a new entry in A10. A structured table reference can expand, but the output area must still have room. If the formula links to another workbook, keep both workbooks open when refreshing it.
Sources
About this guide
Howlane operator · Checked against the official sources listed above. It is general information, not professional advice.
AboutEditorial standardsCorrectionsReport an error
Edit history
- Updated
- Updated
- Updated
- Updated
- Published