New Tool Radar

AI for Data & Spreadsheets

How to Remove Duplicate Rows by a Key Column in Excel

Use Remove Duplicates on a key column, such as email or invoice number, so each key appears once and the first occurrence is kept.

Schematic with three steps: Highlight first, then decide the key; Run Remove Duplicates on the key column; Check the count and the survivors.

The most important decision in removing duplicates is which columns make two rows the same. Removing by all columns only deletes rows identical everywhere; removing by one key column, such as email, keeps one row per client and deletes the rest, including rows that differ elsewhere.

What you need

  • Excel with the table to clean
  • A decision on which column is the key
  • A copy of the workbook, because removal cannot be undone after closing

Step 1: Highlight first, then decide the key

Highlight the duplicates in the key column with conditional formatting and read them. Only remove by a key column after seeing what will go; when unsure, remove by all columns instead.

Step 2: Run Remove Duplicates on the key column

Select the table including its header, open Data, Remove Duplicates, keep My data has headers ticked, untick every column except the key column, and click OK. Excel keeps the first occurrence and reports how many rows it removed.

Step 3: Check the count and the survivors

Compare the remaining row count with the count you expected. Open a few surviving rows and confirm the right copy was kept; undo with Ctrl+Z at once if the count looks wrong.

Worked example: synthetic 25-row client list

The table below is a synthetic example. It shows the expected result of removing duplicates by email; no workbook was opened.

Check Count Result
Rows before 25 Source
Rows removed 3 Three repeat emails
Rows remaining 22 25 minus 3
First occurrence kept 3 Latest row was not kept

Expected result (UNTESTED). 3 of 25 rows are removed as repeat emails, leaving 22 rows with one per email; the first occurrence of each email is kept. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Remove Duplicates keeps the first occurrence, so sort first if you want to keep the newest record.
  • Trailing spaces make values different, so trim the key column before removing.
  • Removing by one column can delete rows that differ in other columns; highlight first and read them.

Sources

See all