fxExcelReps

← How-to guides

How to Find Duplicates in Excel

To find duplicates, count how often each value appears: =COUNTIF($A$2:$A$100, A2)>1 returns TRUE for every value that appears more than once. Copy it down next to the data, then filter on TRUE. To see them at a glance, use conditional formatting instead.

{"cells": {"A1": "Question", "A10": 10452, "A11": 10515, "A12": 10388, "A13": 10598, "A14": 10452, "A15": 10533, "A2": "Duplicate IDs", "A3": "Unique IDs", "A8": "Account ID", "A9": 10388, "B1": "Answer", "B10": "=COUNTIF($A$9:$A$15,A10)\u003e1", "B11": "=COUNTIF($A$9:$A$15,A11)\u003e1", "B12": "=COUNTIF($A$9:$A$15,A12)\u003e1", "B13": "=COUNTIF($A$9:$A$15,A13)\u003e1", "B14": "=COUNTIF($A$9:$A$15,A14)\u003e1", "B15": "=COUNTIF($A$9:$A$15,A15)\u003e1", "B2": "=SUMPRODUCT(--(COUNTIF(A9:A15,A9:A15)\u003e1))", "B3": "=COUNTA(UNIQUE(A9:A15))", "B8": "Is duplicate?", "B9": "=COUNTIF($A$9:$A$15,A9)\u003e1"}, "focus": "B9", "note": "Change an ID in column A so it matches another one."}

Flag each duplicate

Lock the range with $ so it stays the same when you copy the formula down.

=COUNTIF($A$2:$A$100, A2)>1TRUE for every copy, including the first.
=COUNTIF($A$2:A2, A2)>1TRUE only from the second copy on, so the first stays FALSE.

Highlight them

Select the column, Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values, pick a colour. Nothing to type.

Conditional Formatting → Duplicate ValuesColours every repeated value.

Count them

SUMPRODUCT runs COUNTIF for every cell and counts the ones above 1.

=SUMPRODUCT(--(COUNTIF(A2:A100, A2:A100)>1))How many cells hold a repeated value.
=ROWS(A2:A100)-COUNTA(UNIQUE(A2:A100))How many extra copies there are.

Common mistakes

Everything is marked as duplicate
The range isn't locked: COUNTIF(A2:A100, A2) copied down becomes A3:A101, A4:A102… Use $A$2:$A$100.
Numbers stored as text
"10388" as text and 10388 as a number are not counted together. Convert the column first.

Frequently asked questions

How do I find duplicates in two columns?

Use COUNTIF against the other column: =COUNTIF($C$2:$C$100, A2)>0 marks values from A that also appear in C. More in compare two columns.

How do I delete the duplicates afterwards?

See remove duplicates.

Is COUNTIF case-sensitive?

No, so "ELM" and "elm" count as duplicates.

Practise it

COUNTIFUNIQUEConditional formatting

Think you know this?

15 formula tasks, no hints, with a leaderboard. Absolute, relative and mixed references included.

Take the Pro Challenge →

More how-to guides

How to Extract the First Name in Excel

Get the first name from a full name in Excel with LEFT and FIND, or TEXTBEFORE, including names written as Surname, First name.

How to Extract the Last Name in Excel

Get the last name or the last word from a full name in Excel with TEXTAFTER, or RIGHT, LEN and SUBSTITUTE in older versions.

How to Combine First and Last Name in Excel

Join first and last names in Excel with &, CONCAT or TEXTJOIN, with a space, a comma, or initials, and skip empty cells.

How to Split Text by a Delimiter in Excel

Split text at a comma, dash or space in Excel with TEXTBEFORE and TEXTAFTER, LEFT, MID and FIND, or Text to Columns.