Excel Formula to Pull Unique Values from List
In this article
To pull unique values from a list in Excel, use the UNIQUE function: =UNIQUE(A2:A100). This returns a dynamic array of distinct entries from the range, spilling results into adjacent cells. It works in Excel for Microsoft 365, Excel 2021, and Excel for the web. If you have an older version without dynamic arrays, you can use a combination of INDEX, MATCH, and COUNTIF (explained later), but the UNIQUE function is by far the simplest and most reliable method.
What You'll Need
- Excel for Microsoft 365, Excel 2021, or Excel for the web (the
UNIQUEfunction is not available in Excel 2019 or earlier). - A list of values in a single column (or row) that may contain duplicates.
- An empty area of the worksheet where the unique values can spill into.
Step-by-Step
- Select your source range. Identify the column that contains your list. For example, if your data is in column A starting at row 2 and ending at row 100, your range is
A2:A100. Avoid including the header row unless you want the header to appear in the output. - Choose a destination cell. Click on an empty cell where you want the first unique value to appear. Make sure there are enough empty cells below (or to the right, depending on your data orientation) to hold all unique values. If the spill range is blocked, Excel will return a
#SPILL!error. - Enter the formula. Type
=UNIQUE(A2:A100)and press Enter. ReplaceA2:A100with your actual range. If your list is in a row, use a horizontal range likeA2:Z2. - Check the results. Excel will automatically spill the unique values into the cells below your formula. The list updates dynamically if you change the source data.
- Optional: Extract unique values by column. If your data is arranged horizontally and you want unique values going across, the
UNIQUEfunction works the same way; just select a horizontal range. By default,UNIQUEcompares rows, so for a vertical list it returns unique rows (each cell is a row). For a horizontal list, you may need to transpose first or useUNIQUE(A2:Z2, TRUE)to compare columns. - Optional: Return only values that appear exactly once. Use
=UNIQUE(A2:A100,,TRUE). The third argument (exactly_once) set toTRUEreturns only values that occur exactly once in the source range. - Optional: Ignore case and trim spaces. The
UNIQUEfunction is case-sensitive by default. To treat "Apple" and "apple" as the same, you can combine it with other functions likeLOWERor use a helper column. For trailing spaces, useTRIMon the source data first.
Common Mistakes
- Not leaving enough empty cells. If any cell in the spill range contains data, you'll get a
#SPILL!error. Clear the cells below the formula or move the formula to a location with enough free space. - Including the header row. If you include the header in the range, it will appear as a unique value. Either exclude it or use
UNIQUEon the data range only. - Using an unsupported Excel version. The
UNIQUEfunction is not available in Excel 2019 or earlier. If you see#NAME?, your version doesn't support it. - Forgetting that
UNIQUEis case-sensitive. "Apple" and "apple" are treated as different values. If you need case-insensitive uniqueness, you'll need a workaround (e.g., helper column withLOWER). - Expecting the list to sort.
UNIQUEreturns values in the order they first appear. To sort, wrap it inSORT:=SORT(UNIQUE(A2:A100)). - Referencing a whole column. Using
A:Acan be slow and may include the header. Use a specific range likeA2:A1000.
Tips
- Combine with
SORTto get a sorted unique list:=SORT(UNIQUE(A2:A100)). - Combine with
FILTERto exclude blanks:=UNIQUE(FILTER(A2:A100, A2:A100<>"")). - Use
COUNTAto count unique values:=COUNTA(UNIQUE(A2:A100)). - If you need a comma-separated list of unique values, use
TEXTJOIN:=TEXTJOIN(", ", TRUE, UNIQUE(A2:A100)). - For older Excel versions, use the classic array formula:
=IFERROR(INDEX($A$2:$A$100, MATCH(0, COUNTIF($B$1:B1, $A$2:$A$100), 0)), "")entered with Ctrl+Shift+Enter (in legacy versions) and copied down. This is more complex and slower. - Remember that
UNIQUEis dynamic; if you add new data to the source range, the spill range expands automatically only if the source range is a structured table or if you reference the entire column. For a fixed range, you'll need to adjust the formula.
Troubleshooting
- #SPILL! error: The spill range is blocked. Clear the cells below the formula or move the formula to an empty area.
- #NAME? error: Your Excel version doesn't support
UNIQUE. Use the legacy array formula or upgrade to Microsoft 365. - #VALUE! error: The range may contain errors or the formula syntax is incorrect. Check that you're using a valid range.
- Formula returns only one value: Ensure the source range is correct and that there are actually multiple unique values. Also, check that the spill range isn't limited by a table or merged cells.
- Unique values not updating: If the source data changes, the
UNIQUEfunction should update automatically. If not, press F9 to recalculate or check that calculation is set to automatic (Formulas > Calculation Options > Automatic). - Case sensitivity issues: If you need case-insensitive unique values, create a helper column with
=LOWER(A2), then applyUNIQUEto that column, and optionally useINDEX/MATCHto retrieve original values.
Frequently Asked Questions
Can I use UNIQUE on multiple columns?
Yes, UNIQUE can accept a multi-column range, e.g., =UNIQUE(A2:B100). It will return unique rows based on all columns combined. To get unique values from a single column within a multi-column range, specify that column only.
Does UNIQUE work in Excel 2019?
No, UNIQUE is only available in Excel for Microsoft 365, Excel 2021, and Excel for the web. In Excel 2019 and earlier, you must use the legacy array formula with INDEX, MATCH, and COUNTIF.
How do I get unique values from a list that includes blanks?
Use =UNIQUE(FILTER(A2:A100, A2:A100<>"")). This filters out blanks before extracting unique values.
Can I sort the unique list alphabetically?
Yes, wrap UNIQUE in SORT: =SORT(UNIQUE(A2:A100)). For descending order, add -1 as the third argument: =SORT(UNIQUE(A2:A100), 1, -1).
Why does UNIQUE return duplicate-looking values?
Because UNIQUE is case-sensitive and does not trim spaces. "Apple" and "apple " (with trailing space) are considered different. Use TRIM and LOWER in a helper column to normalize data first.
Can I use UNIQUE with a table reference?
Yes, if your data is in an Excel Table, you can use structured references like =UNIQUE(Table1[Column1]). The formula will automatically adjust as the table grows.