Skip to content

How to Get Distinct Values in Excel: UNIQUE, Filter & Duplicates

Distinct value in Excel 2013 and above

Quick answer: To extract distinct values in Excel, use =UNIQUE(A2:A20) in Microsoft 365 or Excel 2021 and later. In Excel 2013, 2016, or 2019, use Data → Advanced Filter → Unique records only to copy a distinct list without changing your original data. You can also use Remove Duplicates, but that method modifies the selected range, so make a copy first.

There is a useful difference between unique and distinct values: a distinct list contains one copy of each different value, while values occurring exactly once are sometimes called unique-only values. In Excel’s UNIQUE function, the third argument controls whether to return only values that appear exactly once. Below, we focus on producing a distinct list.

  1. Remove Duplicates (available in Excel 2013 and later)
  2. Using Advanced Filter (available in Excel 2013 and later)
  3. Using the UNIQUE function (Excel 2021 and Microsoft 365)

Method 1: Using the Remove Duplicates feature

Works with Excel for Microsoft 365, Excel 2021, Excel 2019 and Excel 2016

Excel’s Remove Duplicates command removes repeated entries from the selected range. Warning: this changes the selected data, so duplicate the column first if you need to preserve the original records.

  1. Select a copy of the single-column list, including its header if present. If your data belongs to a multi-column table, select the entire table first so deleting duplicate records cannot misalign neighboring columns.
  2. Go to the Data tab in the Excel ribbon and Click “Remove Duplicates”, a dialog box will appear.
    Excel Data ribbon showing the Remove Duplicates command
  3. Confirm whether My data has headers is checked correctly. Select the column(s) that define a duplicate: checking only one column treats rows with the same value in that column as duplicates, even when other columns differ.
    Remove Duplicates dialog with header and duplicate-key column selection
  4. Click OK, verify the number of removed records, and undo immediately if the wrong columns were selected.

You now have one instance of each different value in the selected range. Remember that this command removes duplicates in place; it does not create a separate result automatically.

Method 2: Using the Advanced Filter

Works with Excel for Microsoft 365, Excel 2021, Excel 2019 and Excel 2016

Advanced Filter can copy a distinct list to a separate location while leaving your source data intact. Include a column heading in the source range and choose an empty destination on the same worksheet as the source when using the Advanced Filter dialog. To place the result on another sheet, initiate Advanced Filter from the destination sheet or copy the resulting list afterward. Advanced Filter produces a snapshot, not an automatically updating formula.

  1. Select the range of cells or the column from which you want to extract distinct values.
  2. Go to the “Data” Tab and click “Advanced” button in the “Sort & Filter” group.
    Excel Data tab showing the Advanced Filter command
  3. In the “Advanced Filter” dialog box, select the option “Copy to another location”
  4. In List range, verify the source range includes the heading (for example, A1:A20). In Copy to, select an empty starting cell on the same sheet (for example, D1); do not overwrite existing values.
  5. Check “Unique records only” checkbox.
    Advanced Filter dialog with Copy to another location and Unique records only options
  6. Click the “OK” button, and Excel will copy the distinct values to the specified location.

Method 3: Use the UNIQUE Function

Available in Microsoft 365, Excel 2021 and later, and supported Excel web/mobile editions; interface and feature availability vary by platform

Excel for Microsoft 365 and Excel 2021 or later support the dynamic-array UNIQUE function. It spills the resulting values into adjacent cells automatically; keep those cells empty to avoid a #SPILL! error.

  1. Create a new column next to the column containing the values you want to extract.
  2. In the first cell of the new column, enter the following formula: <strong><em>=UNIQUE(A2:A20)</em></strong>, where A2:A20 is your source list. Enter the formula in an empty cell outside an Excel Table, because spilled-array formulas cannot spill inside tables.
  3. The formula returns one copy of each distinct value. For values that occur exactly once, use =UNIQUE(A2:A20,,TRUE). The double comma skips the optional by_col argument.

Blank cells and errors: UNIQUE may include a blank-looking result when the source contains empty cells. To exclude genuinely blank cells, use =UNIQUE(FILTER(A2:A20,A2:A20<>"")). If your source includes formulas that return empty strings, inspect the results carefully. A #SPILL! error usually means the output area is occupied or the formula is inside an Excel Table.

Example: Distinct Values vs Values That Occur Once

Suppose cells A2:A6 contain Apple, Banana, Apple, Cherry, Banana. The formula =UNIQUE(A2:A6) returns Apple, Banana, Cherry because each different item appears once in the result. By contrast, =UNIQUE(A2:A6,,TRUE) returns only Cherry, because it is the only item that occurs exactly once in the source.

Which Method Should You Choose?

  • UNIQUE: Best for a formula-based list that updates when source values change.
  • Advanced Filter: Best for copying a distinct snapshot without modifying the source.
  • Remove Duplicates: Best for cleaning repeated records in a copy of your source data.

Frequently asked questions

Does Advanced Filter update when data changes? No. Run it again after changing the source. A dynamic UNIQUE formula recalculates with its source range.

Why does Remove Duplicates delete more rows than expected? The selected duplicate-key columns control what Excel considers the same record. Back up the table, verify the header setting, and select the correct key columns before confirming.

Before You Share the Result

Verify the result against a known sample, check whether blanks should count, and confirm that numbers stored as text are handled consistently. For an automatically updating distinct list, use UNIQUE with a growing Table reference; Advanced Filter creates a static snapshot, while Remove Duplicates changes the selected records.

Check Spaces, Case and Expanding Data

Before deduplicating, check whether values differ only by leading or trailing spaces, nonbreaking spaces, or numbers stored as text. Clean a copy with TRIM when appropriate; ordinary TRIM does not remove every nonbreaking space. Standard Excel duplicate tools are generally case-insensitive, so identifiers such as ABC and abc may require a separate case-sensitive workflow.

A formula using a fixed source range such as =UNIQUE(A2:A20) does not automatically include new values below row 20. For a growing list, use an Excel Table source and enter =UNIQUE(Table1[Product]) outside the Table. Leave room for the result to spill, and verify #SPILL! errors before sharing.

Small Verification Exercise

Enter Apple, Apple (with a trailing space), Banana, banana, and a blank in A2:A6. First try =UNIQUE(A2:A6) outside a Table. Next compare an Advanced Filter copy and Remove Duplicates on a separate backup. Standard Excel duplicate comparisons are generally case-insensitive; a trailing space can still change the comparison. Do not assume all three methods normalize whitespace for you. Record your rules for blank entries and capitalization before using the result in a report.

Troubleshooting distinct-value results

#NAME? often means the Excel version does not support UNIQUE, or the function name was mistyped. #SPILL! means the output cannot expand, often because cells are occupied or the formula is inside a Table. #CALC! can occur if a FILTER expression has no matches; use its optional if_empty argument when an empty result is expected. For unexpected duplicates, inspect whitespace, nonbreaking spaces and inconsistent data types before changing source records.

For the function syntax and spill behavior, consult Microsoft’s UNIQUE function documentation. Also see our guide to removing duplicate rows safely.

Leave a Reply

Your email address will not be published. Required fields are marked *