Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Is There an Excel Function to Find Duplicates?

· 6 min read · Home Tech

In this article
  1. Background: Why Excel Has No Dedicated Duplicate Function
  2. Method 1: Highlight Duplicates With Conditional Formatting
  3. Method 2: Count Duplicates With COUNTIF
  4. Method 3: List Unique Values With UNIQUE
  5. Method 4: Remove Duplicates With the Data Tool
  6. How to Choose the Right Method
  7. Common Problems and How to Fix Them
  8. Frequently Asked Questions

There is no single built-in Excel function named something like FIND_DUPLICATES, but Excel has several reliable ways to locate duplicates: conditional formatting highlights them, COUNTIF counts occurrences of each value, and UNIQUE (in Microsoft 365 and Excel 2021 and later) lists each value only once, which makes the duplicates easy to spot by comparison. Which method you use depends on whether you want to see the duplicates, count them, or remove them.

Background: Why Excel Has No Dedicated Duplicate Function

Excel's function library is built around calculations, not around list hygiene. A function takes inputs and returns a value; "find duplicates" is really a question about relationships between rows, which Excel handles through filters, formatting rules and whole-column comparisons rather than a single command. Over time, Microsoft added tools that make the job easier: conditional formatting rules for duplicate values, the Remove Duplicates data tool, and dynamic array functions such as UNIQUE, FILTER and SORT. The result is a set of overlapping methods, each suited to a different goal.

A common misconception is that Excel will warn you automatically when you type a duplicate. It will not, except in a few specific places: Excel's data validation can block duplicate entries in a column if you set it up, and Excel Tables flag duplicate headers, but ordinary cells accept repeated values without comment. Duplicate detection is something you have to ask for.

Method 1: Highlight Duplicates With Conditional Formatting

This is the fastest way to see duplicates without changing any data. Menu labels can differ slightly by version and platform, but the path is stable.

  1. Select the range or column you want to check. Include the header row only if you want the header compared too, which is usually not what you want.
  2. On the Home tab, open Conditional Formatting.
  3. Choose Highlight Cells Rules, then Duplicate Values.
  4. Pick a formatting style and confirm. Every value that appears more than once gets the highlight.

The same dialog has a dropdown where you can switch from Duplicate to Unique, which is handy when you want to see the values that appear only once. Conditional formatting only highlights what is already there; it does not tell you how many copies exist, and the highlight does not survive sorting into another workbook unless you copy the formatting along with the cells.

Method 2: Count Duplicates With COUNTIF

When you need numbers rather than colours, COUNTIF is the workhorse. Put a formula in the first data row and fill it down:

  • =COUNTIF(A:A, A2) counts how many times the value in A2 appears in column A. A result of 1 means unique; 2 or more means duplicate.
  • =COUNTIF($A$2:$A$100, A2)>1 returns TRUE for duplicates and can be filtered or used inside IF.
  • For a cleaner label, wrap it: =IF(COUNTIF($A$2:$A$100, A2)>1, "Duplicate", "").

Two cautions matter here. First, COUNTIF treats text as case-insensitive, so "Apple" and "apple" count as the same value; it also ignores the difference between numbers stored as text and true numbers, so "007" and 7 may or may not match depending on how the cells are formatted. Second, COUNTIF with a full-column reference can be slow on very large sheets; use a bounded range such as $A$2:$A$5000 instead.

Method 3: List Unique Values With UNIQUE

In Microsoft 365 and Excel 2021 or later, the UNIQUE function returns the distinct values of a range in one step. =UNIQUE(A2:A100) spills a list of every value that appears at least once. Add the optional arguments to count only values that appear once: =UNIQUE(A2:A100,,TRUE). To get the values that repeat, compare the two lists or use a COUNTIF alongside a filter. Older Excel versions do not have UNIQUE, and any workbook that relies on it will show a #NAME? error when opened there.

Method 4: Remove Duplicates With the Data Tool

If the goal is to delete the extra rows rather than inspect them, select the data range and use Data > Remove Duplicates. Excel asks which columns define a duplicate. Choosing every column removes only rows identical in all fields; choosing just one column, such as an email address, removes rows that share that value even if other fields differ.

Warning: this tool permanently deletes rows from the current sheet, keeps only the first occurrence, and cannot be undone by re-running it. Save a copy of the workbook or work on a duplicate sheet first. If you want a reviewable result, filter on a COUNTIF helper column instead and delete deliberately.

How to Choose the Right Method

  • Just want to see them: conditional formatting, because it touches nothing.
  • Need counts or a filterable list: COUNTIF with a helper column.
  • Want a clean list of distinct values: UNIQUE, on a version that supports it.
  • Want the duplicates gone: Remove Duplicates, after backing up.
  • Checking combinations, like first name plus surname: COUNTIFS or conditional formatting on a helper column that concatenates the fields.

Common Problems and How to Fix Them

  • Trailing spaces: "Smith" and "Smith " look identical but count as different. Use TRIM to clean the column before checking.
  • Mixed text and numbers: a ZIP code stored as text in one row and as a number in another will not match. Convert the column to one format first.
  • Partial matches: COUNTIF does not support wildcards reliably in all cases, so exact matching is safer than searching for fragments.
  • Blank cells: COUNTIF will happily count empty cells as duplicates; exclude them with a condition such as IF(A2="","",...).
  • Formulas pointing at the wrong range: absolute references ($A$2:$A$100) stop the range from shifting when you fill the formula down.

Frequently Asked Questions

Is there a single Excel function that finds duplicates?

No. CountIF is the closest thing to a duplicate-detection function, since it tells you how many times a value appears. UNIQUE gives you the opposite list, the distinct values. For visual highlighting you rely on conditional formatting, not a function.

Why does COUNTIF say two different-looking values are duplicates?

COUNTIF is not case-sensitive, so it treats "apple" and "APPLE" as the same value. It can also treat a number stored as text and the same number as a real number as matches. If case matters, use an array formula with EXACT instead of COUNTIF.

Can I find duplicates across two different columns or sheets?

Yes. Point COUNTIF at the other column or the other sheet's range, for example =COUNTIF(Sheet2!A:A, A2). Use COUNTIFS when you need several conditions to match at once.

Does Remove Duplicates keep the first or last copy?

It keeps the first row it encounters and deletes later ones. Because the order of your data determines which row survives, sort or back up the sheet before running it.

Can I prevent duplicates from being entered at all?

Partly. Data validation with a custom COUNTIF rule can block a repeated value in a column. It is not a security measure and can be bypassed by pasting, so treat it as a helpful guard rather than a lock.

Why does UNIQUE show a #NAME? error?

UNIQUE exists only in Microsoft 365 and Excel 2021 or later. In older versions the formula is unrecognised, so use COUNTIF or conditional formatting instead.