Excel UNIQUE Not Returning All Values? Fix It
In this article
The UNIQUE function in Excel returns a list of distinct values from a range, but it can appear to miss values when the source contains trailing spaces, inconsistent case, numbers stored as text, or when the formula's spill range is blocked. To get all unique values, clean the data first (TRIM, consistent data types), ensure the formula has room to spill, and verify that you are referencing the full range. If UNIQUE still drops items, check for hidden rows, filters, or manual calculation mode.
What You'll Need
- Excel 365, Excel 2021, or Excel for the web (UNIQUE is not available in Excel 2019 or earlier).
- A data range with a single column or row of values to deduplicate.
- An empty area below or to the right of the formula where results can spill.
- Basic familiarity with cell references and the formula bar.
Step-by-Step
- Confirm your Excel version supports UNIQUE. Type
=UNIQUE(in an empty cell. If Excel suggests the function, you have it. If you get #NAME?, your version does not include dynamic arrays; you will need Excel 365, Excel 2021, or Excel for the web. - Select the entire source range, not just the visible cells. For example, if your data is in A2:A100, reference A2:A100. If you reference only A2:A50, values below row 50 will be ignored. Use a whole-column reference like A:A only if the sheet has no other content in that column that you do not want included.
- Clear the spill area. Click the cell where you entered the formula. If you see a #SPILL! error, something is blocking the cells below or to the right. Delete or move the blocking content, or enter the formula in a location with enough empty cells.
- Clean trailing and leading spaces. In a helper column, enter
=TRIM(A2)and fill down. Then point UNIQUE at the helper column:=UNIQUE(TRIM(A2:A100))works in dynamic-array Excel, but if it does not, use the helper column approach. Spaces are the most common reason two values that look identical are treated as different. - Unify data types. Numbers stored as text (often left-aligned) will not match real numbers. Select the column, use Data > Text to Columns > Finish to convert text-numbers to real numbers, or use
=VALUE()in a helper column. Then run UNIQUE on the cleaned column. - Check for hidden rows or filters. UNIQUE includes hidden rows by default. If you applied a filter and expect only visible values, UNIQUE will still return values from hidden rows. To get unique visible values, use a helper column with
=SUBTOTAL(103, A2)to flag visible rows, then filter the UNIQUE result or use FILTER first:=UNIQUE(FILTER(A2:A100, SUBTOTAL(103, OFFSET(A2:A100, ROW(A2:A100)-MIN(ROW(A2:A100)),0,1))))— this is advanced; a simpler approach is to remove filters before running UNIQUE. - Verify calculation mode. If Excel is set to Manual calculation (Formulas > Calculation Options > Manual), the formula may not update. Press F9 to recalculate, or switch to Automatic.
- Test with a small range. Copy a few known duplicate values into a new sheet and run
=UNIQUE(range). If it works there, the issue is in your original data (spaces, data types, or range boundaries). - Use UNIQUE with other functions if needed. To ignore blanks, combine with FILTER:
=UNIQUE(FILTER(A2:A100, A2:A100<>"")). To sort the unique list, wrap with SORT:=SORT(UNIQUE(A2:A100)).
Common Mistakes
- Referencing a partial range. If new data is added below the referenced range, UNIQUE will not include it. Use a full-column reference or convert the range to an Excel Table and reference the table column (e.g., Table1[Column1]) so the range expands automatically.
- Ignoring trailing spaces. "Apple" and "Apple " look the same but are different to Excel. Always TRIM before UNIQUE.
- Mixing numbers and text. A number 123 and text "123" are distinct. Convert to a consistent type.
- Forgetting about case sensitivity. UNIQUE is case-insensitive by default: "apple" and "Apple" are treated as the same value. If you need case-sensitive unique values, use a helper column with EXACT or a more complex array formula.
- Placing the formula where it cannot spill. Dynamic arrays need empty space. If you see #SPILL!, clear the area.
- Using UNIQUE in a version that does not support it. Excel 2019 and earlier will return #NAME?. Use Remove Duplicates (Data > Remove Duplicates) as an alternative.
Tips
- Use Excel Tables (Insert > Table) so your UNIQUE formula automatically includes new rows.
- Combine UNIQUE with SORT and FILTER for cleaner output:
=SORT(UNIQUE(FILTER(A2:A100, A2:A100<>""))). - To count unique values, use
=COUNTA(UNIQUE(range))or=ROWS(UNIQUE(range)). - If you need a static list, copy the spill result and paste as values.
- Check for non-printing characters using CLEAN in a helper column if TRIM alone does not fix duplicates.
Troubleshooting
If UNIQUE returns fewer values than expected, work through these checks in order:
- #SPILL! error: Clear the cells below or to the right of the formula. If the formula is in a table, move it outside the table.
- #NAME? error: Your Excel version does not support UNIQUE. Use Data > Remove Duplicates or upgrade to Microsoft 365.
- Missing values that exist in the source: Check for trailing spaces (use TRIM), inconsistent data types (convert text to numbers), or a range that does not cover all rows. Also check if the source has blank cells—UNIQUE includes a 0 for blanks unless you filter them out.
- Formula not updating: Set calculation to Automatic (Formulas > Calculation Options > Automatic) or press F9.
- Values appear duplicated in the result: This can happen if the source has values that differ only by case (UNIQUE is case-insensitive) or by hidden characters. Use EXACT to compare or CLEAN to remove non-printing characters.
- UNIQUE works in a new sheet but not the original: The original sheet may have merged cells, protected cells, or a filter that affects the range. Unmerge, unprotect, or clear filters.
Frequently Asked Questions
Why does UNIQUE return duplicates?
UNIQUE is case-insensitive, so "Apple" and "apple" are treated as one value. It also treats numbers and text that look the same as different. Check for trailing spaces and data type mismatches.
Can UNIQUE include blank cells?
Yes, UNIQUE returns a 0 for blank cells in the range. To exclude blanks, wrap with FILTER: =UNIQUE(FILTER(range, range<>"")).
Does UNIQUE work in Excel 2019?
No. UNIQUE is available only in Excel 365, Excel 2021, and Excel for the web. In older versions, use Data > Remove Duplicates.
How do I get unique values from multiple columns?
UNIQUE works on a single row or column. To combine multiple columns, use =UNIQUE(VSTACK(A2:A10, B2:B10)) in Excel 365, or copy both columns into one helper column first.
Why is my UNIQUE formula not spilling?
The spill range is blocked. Clear the cells below or to the right, or move the formula to an empty area. Also ensure the workbook is not in Manual calculation mode.
Can I use UNIQUE on a filtered range?
UNIQUE includes hidden rows by default. To get unique visible values, use FILTER with SUBTOTAL first, or remove the filter before running UNIQUE.