Field Guide

Remove duplicates in Excel: highlight, delete, and check first

Updated

To remove duplicates in Excel: select the range, go to Data > Remove Duplicates, check the columns that should count toward a duplicate, and select OK. To find duplicates without deleting anything: select the cells and go to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values. Microsoft’s guidance is to do those two in the opposite order, review first and delete second, because the delete step removes whole rows permanently and reports back only a count.

This page covers the whole job: how to highlight duplicates, what Excel actually counts as a duplicate, what the column checkboxes in the Remove Duplicates box really delete, the filter that produces a unique list without touching the data, and the formula that marks repeats.

How do I highlight duplicates in Excel?

Conditional formatting is the review step. It marks the duplicate data in place, so you can review the duplicates and decide whether any should go:

  1. Select the cells you want to check for duplicates.
  2. Select Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values.
  3. In the box next to values with, pick the format the duplicates should get, then select OK.

The duplicate values now carry the format, and nothing has been removed. Duplicate Values is one entry under Highlight Cells Rules; the rest of conditional formatting, from data bars to formula rules, is in conditional formatting in Excel. One documented limit: Excel cannot highlight duplicates in the Values area of a PivotTable report.

What does Excel count as a duplicate?

Microsoft’s definition works row by row: a duplicate is a row whose every value is identical to the values of another row. Two rows that agree in three columns out of four are not duplicates; the match has to be complete across the columns being compared.

The subtler part is what “identical” means. Per Microsoft’s page on unique and duplicate values, “A comparison of duplicate values depends on what appears in the cell”, rather than on whatever value sits underneath the format. Its example is a date: the same date value in two cells, one displayed as 3/8/2006 and the other as Mar 8, 2006, counts as unique, not duplicate. The two cells store the same thing and show different things, and the comparison goes by what they show. If a deduplication pass leaves repeats behind, differently formatted dates are a prime suspect; how one serial number ends up displayed in several formats is covered in Excel date formats.

How do I remove duplicates in Excel?

Before running it, make a copy. Remove Duplicates deletes permanently, and Microsoft’s advice on both of its pages is to copy the original data somewhere safe first, a separate worksheet or workbook, so nothing is lost by accident.

Here is a five-row roster with one true duplicate in it:

A B
1 Name Dept
2 Maria Jones Sales
3 Sam Ortiz Finance
4 Maria Jones Sales
5 Priya Patel Sales
6 Sam Ortiz Marketing
Rows 2 and 4 match in every column, so they are duplicates. The two Sam Ortiz rows match only in column A, so they are not. A4:B4 is the row Remove Duplicates will delete.

To run it:

  1. Select the range of cells, or make sure the active cell sits inside a table.
  2. Select Data > Remove Duplicates. On the ribbon it sits in the Data Tools group.
  3. Under Columns, check the columns that should count toward a duplicate. For the roster above, leave both Name and Dept checked.
  4. Select OK.
A B
1 Name Dept
2 Maria Jones Sales
3 Sam Ortiz Finance
4 Priya Patel Sales
5 Sam Ortiz Marketing
After Data > Remove Duplicates with both columns checked: the first Maria Jones row stays, its duplicate is gone, and the rows below moved up. Both Sam Ortiz rows survive because their departments differ.

Excel keeps the first occurrence of each duplicated value and deletes the later matches, then reports back with a message: either the number of duplicate values removed or the number of unique values that remain. Select OK to dismiss it. Two documented caveats about that message:

The command touches only the selected range or table; cells outside the selection stay put. And it refuses outlined or subtotaled data outright: remove the outline and the subtotals first, then deduplicate.

What do the column checkboxes actually delete?

The Columns list in the Remove Duplicates box is the setting that decides how much gets deleted, so give it a careful look before you select OK. Select All and Unselect All flip every checkbox at once, and with a wide table it is easier to clear everything and then check the two or three columns that matter.

What the checkboxes control is the comparison, not the deletion. The checked columns form the key Excel uses to find duplicates, and Microsoft spells out the consequence: “If a duplicate is found in those columns, then the entire row will be removed, including other columns in the table or range.” Unchecking a column does not shield its data. It only removes that column from the key, which usually means more rows match and more rows go.

Run the same roster again with only Name checked:

A B
1 Name Dept
2 Maria Jones Sales
3 Sam Ortiz Finance
4 Priya Patel Sales
The original roster after Remove Duplicates with only Name checked: the key is column A alone, so the second Sam Ortiz row counted as a duplicate and was deleted whole, Marketing department and all.

Sam Ortiz worked in Finance on one row and Marketing on the other. With Dept out of the key, the second row became a duplicate of the first, and the whole row went, department included. Nothing in the message flags this: it gives a count and never lists the rows it removed.

How do I check for duplicates without deleting anything?

Microsoft’s guidance before any removal is to try filtering on unique values, or conditionally formatting them, first, to confirm the result is what you expect. The highlight rule above is one half of that; the Advanced filter is the other, and it doubles as the way to produce a clean unique list while leaving the source untouched.

  1. Select the range of cells, or make sure the active cell sits inside a table.
  2. Select Data > Advanced, in the Sort & Filter group.
  3. In the Advanced Filter box, choose Filter the list, in-place to hide duplicate rows where they stand, or Copy to another location and put a cell reference in the Copy to box to write the unique rows somewhere else.
  4. Check Unique records only, then select OK.

Filtering only hides the duplicates for the moment. Clear the filter and they are all still there, the opposite of Remove Duplicates and its permanent deletion.

Which formula finds duplicates?

A COUNTIF helper column marks every value that appears more than once, which gives you a flag you can sort, filter, or eyeball before deciding anything:

C2
fx
=COUNTIF($A$2:$A$6,A2)>1
A B C
1 Name Dept Repeat?
2 Maria Jones Sales TRUE
3 Sam Ortiz Finance TRUE
4 Maria Jones Sales TRUE
5 Priya Patel Sales FALSE
6 Sam Ortiz Marketing TRUE
C2 counts how often A2 appears in A2:A6 and tests the count against 1. Every name that appears twice shows TRUE, including both Sam Ortiz rows, because the formula reads one column and ignores the departments.

Fill the formula down and every repeated name shows TRUE. The shape is one Microsoft itself documents: its unique-values page gives =COUNTIF($A$2:$A$400,A2)>1 as a conditional formatting formula for identifying duplicate values in A2:A400. Note the difference in scope from the ribbon command, visible in the grid: COUNTIF here reads a single column, so both Sam Ortiz rows come up TRUE even though a whole-row comparison would keep them both. How COUNTIF and its criteria argument work, including the absolute reference that pins $A$2:$A$6 while A2 slides, is covered in COUNTIF and SUMIF.

Does Remove Duplicates work in Excel for the web?

Yes. Microsoft’s web instructions run the same way: select the range or a cell in the table, select Data > Remove Duplicates, unselect any columns you do not want to count toward a duplicate, and select OK; a message reports how many duplicate values were removed. The same whole-row warning applies, and the web page adds that Undo can always bring the data back afterward, while still advising the copy-to-another-worksheet step first. The highlight rule and the Advanced filter are documented under the Windows procedures.

The short version

Frequently asked questions

How do I remove duplicates in Excel?
Select the range of cells, or make sure the active cell is in a table, then go to Data > Remove Duplicates. Under Columns, choose which columns should count toward a duplicate, and select OK. A message reports either how many duplicate values were removed or how many unique values remain. The deletion is permanent, so Microsoft advises copying the original range to another worksheet or workbook first.
How do I find duplicates in Excel without deleting them?
Highlight them. Select the cells to check, go to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values, pick a format in the box next to values with, and select OK. The duplicates get the format and nothing is removed, so you can review them and decide what to do. Filtering with Data > Advanced and Unique records only also leaves the data intact: it only hides the duplicates temporarily.
What counts as a duplicate in Excel?
A row whose values are all identical to the values in another row. The comparison depends on what appears in the cell, not on the value stored underneath, so the same date in two cells counts as unique when one is formatted 3/8/2006 and the other Mar 8, 2006. Rows that match in some columns but not all are not duplicates unless you limit the comparison to the matching columns with the checkboxes.
Does Remove Duplicates delete the entire row?
Yes. The columns you check form the key used to find duplicates, and when a duplicate is found on that key, the whole row is removed, including the columns you left unchecked. The first occurrence stays and the later matches are deleted. Unchecking a column does not protect its data; it only takes that column out of the comparison.
Can I undo Remove Duplicates?
Yes. Selecting Undo, or pressing Ctrl+Z, brings the data back after a removal; Excel for the web documents Undo as well. Microsoft still recommends copying the original data to a separate worksheet or workbook before you delete, since the removal itself is permanent.
What formula finds duplicates in Excel?
COUNTIF. A helper column of =COUNTIF($A$2:$A$400,A2)>1 shows TRUE beside every value in A2:A400 that appears more than once, and Microsoft documents that same formula as a conditional formatting rule for identifying duplicate values. Note that it flags repeats within one column, while Remove Duplicates with every column checked compares whole rows.

Catch the errors before they ship

Reviewing a change to a model? Compare the two versions in your browser and see every changed cell, formula, and value. It's free, and nothing leaves your computer.