Remove duplicates and choose what counts as a copy
Clean up messy data8 min
Builds on Count what matches with COUNTIF and COUNTIFS.
An events coordinator in Copenhagen merges the sign-ups from two booking tools before printing badges. Anyone who used both tools is on the list twice, one man with his name spelled two ways.
How it works
Data > Remove Duplicates, on Windows and on a Mac, deletes the rows that repeat an earlier row in the columns you tick. Click a cell in the list, choose the command, leave My data has headers ticked when row 1 holds headings, tick the columns and click OK. Excel reads the list from the top, keeps the first row of each set and deletes the later ones, so sort newest first if you want the latest. It then reports how many rows went.
The columns you tick decide what counts as a copy, and Excel deletes the whole row, columns you didn't tick included:
- With Email ticked, any later row with an email seen higher up goes, even when the name is spelled differently.
- With every column ticked, a row goes only when it matches an earlier one in every cell, as when an export ran twice with nothing changed.
Count before you delete. In a helper column, COUNTIF over the whole column, locked with $ signs, shows how often each row's value appears, and anything above 1 has copies to look at first. CtrlZ (CmdZ on a Mac) straight after brings the rows back.
Example
Five sign-ups, with Email ticked and then both columns:
Common mistakes
- Every column ticked for a contact list. Copies with a name spelled differently stay. Tick the column that identifies a person, such as Email.
- One column selected, then Continue with the current selection. Only that column's cells move up, out of line with the rest of each row. Expand the selection.
- A copy that won't go away. Excel compares what the cells show, so a space at the end, or the same date in another format, makes two values differ. Clean the column first.
- A column that changes from run to run, such as an export time, left ticked. The repeats differ there and stay. Untick it.
How to remove duplicates in Excel shows how to keep the original list with UNIQUE or Advanced Filter, and the other reasons a copy stays.
In short
- Remove Duplicates keeps the first row of each set and deletes the later ones, whole rows.
- The columns you tick decide what a copy is: Email for people, every column for exact repeats.
- Count the copies with COUNTIF first, and keep CtrlZ in mind.
Practice
4 exercises · free, no account needed