Data quality

How to remove duplicates in Excel (four ways, and the traps)

Remove Duplicates is one click, but it deletes rows for good and misses near-duplicates. Four methods, when to use each, and how to catch the duplicates Excel does not see.

TEPtThe ExcelToolkit Pro teamEditorial3 min read
Post on XLinkedIn
An Excel list with duplicate rows highlighted before removal

There are four good ways to deal with duplicates in Excel, and which one you want depends on whether you want to delete them, list unique values, or just see them first. If you would rather not touch the original at all, the Remove Duplicates tool writes a clean copy plus an audit sheet of what was removed, in your browser.

Before you start: save a copy

The built-in Remove Duplicates deletes rows. Undo works straight afterwards, but not once you have saved and closed the file. Duplicate the sheet first (right-click the tab → Move or Copy → Create a copy) if the data matters.

Method 1: the Remove Duplicates button

  1. Click any cell in your data.
  2. Go to Data → Remove Duplicates.
  3. Tick the columns that define a duplicate. Untick the rest.
  4. Press OK. Excel reports how many duplicates were removed and how many unique values remain.

The column choice is the important part. With every column ticked, two rows count as duplicates only if they match in every column. Tick only Email, and Excel keeps the first row for each email address and deletes the later ones, even if their other columns differ.

What it keeps: the first occurrence, from the top. If you want to keep the most recent record instead, sort by date newest-first before removing duplicates.

Method 2: the UNIQUE function (Microsoft 365 and Excel 2021+)

To get a list of distinct values without changing the source:

=UNIQUE(A2:A500)

The result spills down as far as needed and updates when the source changes. Useful variations:

=SORT(UNIQUE(A2:A500))
=UNIQUE(A2:C500)
=UNIQUE(A2:A500,,TRUE)

The second returns unique combinations of three columns; the third returns only the values that appear exactly once.

Method 3: highlight duplicates first

When you want to look before deleting:

  1. Select the column.
  2. Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values.
  3. Pick a colour and press OK.

Then filter by colour (Data → Filter, then the header’s Filter by Color) to see all the duplicates together.

Method 4: a COUNTIF helper column

For full control, add a column that counts how many times each value appears:

=COUNTIF($A$2:$A$500, A2)

Anything above 1 is a duplicate. To flag only the second and later copies, so the first can be kept:

=COUNTIF($A$2:A2, A2)>1

Note the anchoring: the range starts fixed at $A$2 and grows as the formula is filled down. Filter the helper column for TRUE and delete those rows. The COUNTIF Generator writes these with the right quotes and anchors.

The duplicates Excel does not see

Every method above compares values exactly, apart from letter case. So these all look like different values to Excel, and survive:

  • Trailing or double spaces: "Acme Ltd" and "Acme Ltd " (with a space at the end).
  • Non-breaking spaces copied from web pages, which look identical to normal spaces.
  • Numbers stored as text next to real numbers: 1001 and "1001".
  • Different punctuation: "Acme Ltd" and "Acme Ltd."

Fix them before removing duplicates. A helper column with =TRIM(CLEAN(A2)) handles spaces and invisible characters; the Excel Data Cleaner does this across whole sheets at once, including non-breaking spaces and numbers stored as text.

Case: Remove Duplicates, UNIQUE and COUNTIF all treat "ACME" and "acme" as the same. That is usually what you want. If case matters (product codes, for example), use a helper column with EXACT, or a tool with a case-sensitive option.

Finding duplicates across two lists

To see which customers in list A also appear in list B:

=COUNTIF(Sheet2!$A:$A, A2)>0

TRUE means the value exists in the other list. For a fuller comparison of two files, the Duplicate Finder reports every duplicate with its real row numbers.

TEPt

The ExcelToolkit Pro team

Editorial

We build the browser-based tools on this site, and we write these guides from the problems that actually come through the contact form — broken lookups, workbooks that will not open, exports that arrive mangled. Everything here is tested against real files before it is published.

Get the next one by email

New guides every other Tuesday. Unsubscribe in one click.

No spam. Unsubscribe in one click.

Keep reading

Before and after view of a messy CSV file cleaned into a structured table
Data quality3 min read

A repeatable process for cleaning messy CSV exports

The same six problems appear in every system export. Fixing them in a fixed order takes ten minutes and never has to be reinvented.

TEPtThe ExcelToolkit Pro teamEditorial
A PDF bank statement beside the same table opened as an Excel sheet
Security & privacy4 min read

Convert PDF to Excel without uploading it

Most PDF converters send your file to their server. For bank statements and payroll that is a real risk. How to get the table out of a PDF while the file stays on your computer.

TEPtThe ExcelToolkit Pro teamEditorial