Excel Formula for Unique List: Step-by-Step Guide
In this article
To get a unique list in Excel, use the UNIQUE function: in a blank cell, type =UNIQUE(A2:A100) and press Enter. This spills a list of distinct values from the range. If you are on an older Excel version without UNIQUE, use the array formula =IFERROR(INDEX($A$2:$A$100, MATCH(0, COUNTIF($D$1:D1, $A$2:$A$100), 0)), "") entered with Ctrl+Shift+Enter, or use a PivotTable. The steps below cover the modern function first, then the fallback.
What You'll Need
- Excel 365, Excel 2021, or Excel for the web for the UNIQUE function. Excel 2019 and earlier do not have it.
- A column or range of data with duplicates you want to collapse.
- An empty area of the sheet where the result can spill (at least as many rows as unique values, and one column wide).
- Optional: a header row if you want to keep labels separate from the data.
Step-by-Step
- Pick your source range. Select the column that contains the values, for example A2:A100. Avoid including the header row in the range unless you want the header treated as a value. If your data is in an Excel Table, note the table name; you can reference it as
Table1[Column1]. - Choose an output cell. Click a blank cell where the list should start, such as D2. Make sure the cells below and to the right are empty; the formula will spill into them and a #SPILL! error appears if they are not.
- Enter the UNIQUE formula. Type
=UNIQUE(A2:A100)and press Enter. Excel returns the distinct values in the order they first appear. The result is a dynamic array; you do not need to drag it down. - Decide whether to compare by row or by column. By default UNIQUE compares each row. If your data runs across columns instead of down rows, add the second argument:
=UNIQUE(A2:Z2, TRUE). Use TRUE to compare by column, FALSE (or omit it) to compare by row. - Handle case sensitivity if needed. UNIQUE treats "Apple" and "apple" as the same by default. To treat them as different, add the third argument:
=UNIQUE(A2:A100, FALSE, TRUE). The third argument is exactly_once; set it to TRUE only when you want values that appear exactly once, not all distinct values. - Sort the result if you want it alphabetical. Wrap UNIQUE in SORT:
=SORT(UNIQUE(A2:A100)). For descending order use=SORT(UNIQUE(A2:A100), 1, -1). SORT and UNIQUE are both dynamic array functions, so they work together in Excel 365 and 2021. - Count the unique values. If you only need the number, use
=COUNTA(UNIQUE(A2:A100))or=ROWS(UNIQUE(A2:A100)). Place it in a single cell; it will not spill because it returns one number. - For older Excel, use the array formula. In Excel 2019 or earlier, select D2, type
=IFERROR(INDEX($A$2:$A$100, MATCH(0, COUNTIF($D$1:D1, $A$2:$A$100), 0)), ""), then press Ctrl+Shift+Enter (Cmd+Shift+Enter on Mac). Copy the formula down until you see blanks. The D1 reference must point to the cell just above the first formula; adjust if your layout differs. - Or use a PivotTable. Select your data, go to Insert > PivotTable, place it on the same sheet, and drag the field into the Rows area. A PivotTable lists each distinct value once. This works in every Excel version and needs no formula.
- Verify the output. Compare the count of unique values with a manual check on a small sample. If the list looks wrong, confirm the source range does not include blank rows that should be excluded, and that no cells below the output are occupied.
Common Mistakes
- #SPILL! error. The output area is not empty. Clear the cells below and to the right of the formula cell, or move the formula to an empty block.
- #NAME? error. Your Excel version does not support UNIQUE (pre-2021). Use the array formula or a PivotTable instead.
- Including the header. If A1 contains "Name" and you use A1:A100, the header appears as a value. Start the range at A2.
- Forgetting Ctrl+Shift+Enter. The legacy array formula returns #VALUE! or a wrong result if entered as a normal formula. Press Ctrl+Shift+Enter and confirm braces appear around the formula.
- Relative vs absolute references. In the legacy formula, $A$2:$A$100 must be absolute while $D$1:D1 grows as you copy down. Mixing these up repeats the first value or produces errors.
- Expecting UNIQUE to ignore blanks. By default, blank cells in the range are included as a 0 or empty entry. Filter them out with
=FILTER(UNIQUE(A2:A100), UNIQUE(A2:A100)<>"")if needed.
Tips
- Use an Excel Table (Ctrl+T) as the source so the formula range expands automatically when you add rows.
- Combine UNIQUE with SORT and FILTER for a clean, sorted, blank-free list:
=SORT(FILTER(UNIQUE(A2:A100), UNIQUE(A2:A100)<>"")). - If you need the unique list to update when data changes, keep the source range as a whole-column reference like A:A, but be aware it may include blanks; wrap with FILTER.
- To count how many times each value appears, use
=COUNTIF(A2:A100, D2)next to each unique entry. - Dynamic arrays spill automatically; do not copy the formula down, or you will get a #SPILL! error from overlapping results.
Troubleshooting
- Formula returns only one value. You may have entered it as a normal formula in an older Excel version. Re-enter with Ctrl+Shift+Enter, or upgrade to Excel 365/2021.
- #SPILL! persists. Check for merged cells, hidden rows, or text in the spill range. Select the formula cell and use the error checker to see the blocking range.
- Values appear as 0. Blank cells in the source are being treated as zero. Use FILTER to remove blanks before UNIQUE.
- Case-sensitive list not working. Confirm the third argument is TRUE and that you are using a version that supports it. In older Excel, case-sensitive unique lists require a more complex array formula.
- PivotTable shows blanks. Blank cells in the source appear as a blank row. Filter them out in the PivotTable field settings.
Frequently Asked Questions
Does UNIQUE work in Excel 2019?
No. UNIQUE is available in Excel 365, Excel 2021, and Excel for the web. In Excel 2019 and earlier, use the INDEX/MATCH/COUNTIF array formula or a PivotTable.
How do I get a unique list that ignores blanks?
Wrap UNIQUE in FILTER: =FILTER(UNIQUE(A2:A100), UNIQUE(A2:A100)<>""). This removes empty results from the spill range.
Can I sort the unique list alphabetically?
Yes. Use =SORT(UNIQUE(A2:A100)) for ascending order or add the sort order and direction arguments for descending.
Why do I get #SPILL! with UNIQUE?
The cells where the result needs to appear are not empty. Clear the area below and to the right of the formula, or move the formula to an empty block of cells.
Does UNIQUE treat uppercase and lowercase as the same?
Yes, by default. To treat them as different, set the third argument to TRUE: =UNIQUE(A2:A100, FALSE, TRUE).
Can I use UNIQUE on multiple columns?
Yes. Select a two-column range like A2:B100 and UNIQUE returns distinct rows based on both columns together. To compare by column instead, set the second argument to TRUE.