How to Find and Highlight Duplicates in Excel (Step-by-Step Guide)

Duplicate entries in Excel can lead to incorrect calculations, inaccurate reports and unnecessary confusion. Whether you are managing employee records, customer information, invoices or inventory, identifying repeated values is an important part of maintaining accurate spreadsheet data.

In this guide, you will learn how to find and highlight duplicates in Excel without deleting your original data, using conditional formatting and simple Excel formulas.

1. Sample Data for Practice

Create a new Excel worksheet and enter the following sample data, starting in cell A1.

Employee ID Employee Name Department
E001JamesSales
E002EmmaFinance
E003OliverIT
E002EmmaFinance
E004SophiaHR
E005WilliamSales
E005WilliamSales

In this example, employee IDs E002 and E005 appear twice. We will use these records to demonstrate different methods of identifying duplicates.

2. Highlight Duplicates Using Conditional Formatting

Conditional formatting is a quick way to identify duplicate values without using formulas.

  1. Select cells A2:A8.
  2. Open the Home tab in Excel.
  3. Click Conditional Formatting.
  4. Open Highlight Cells Rules and select Duplicate Values.
  5. Choose your preferred highlight colour.
  6. Confirm the rule by clicking OK.

Excel will highlight both occurrences of E002 and E005. The other employee IDs will remain unchanged.

Tip: This method changes the appearance of your data, not the underlying values.

3. Find Duplicates Using the COUNTIF Formula

If you want a separate column that identifies duplicates, the COUNTIF function provides a useful alternative.

Enter the heading "Status" in cell D1. In cell D2, enter the following formula:

=IF(COUNTIF($A$2:$A$8,A2)>1,"Duplicate","Unique")

Copy the formula down to cell D8.

The COUNTIF function counts how many times the employee ID appears in the selected range. If it appears more than once, the formula returns Duplicate. Otherwise, it returns Unique.

Expected Results

Employee IDOccurrencesStatus
E0011Unique
E0022Duplicate
E0031Unique
E0022Duplicate
E0041Unique
E0052Duplicate
E0052Duplicate

4. Identify Only the Second and Subsequent Occurrences

Sometimes you need to keep the first occurrence of a value and identify only the repeated entries that appear afterwards.

Use this formula in cell D2 and copy it down:

=IF(COUNTIF($A$2:A2,A2)>1,"Duplicate","First occurrence")

Unlike the previous formula, this version uses an expanding range. Only the second occurrence of E002 and the second occurrence of E005 will be marked as duplicates.

This approach is particularly useful when preparing records for data cleaning.

5. Highlight Entire Rows Containing Duplicate IDs

Highlighting an entire row makes duplicate records easier to review in larger spreadsheets.

  1. Select the data range A2:C8.
  2. Open Conditional Formatting from the Home tab.
  3. Create a New Rule.
  4. Choose the option to use a formula to determine which cells to format.
  5. Enter the formula below.
  6. Select a fill colour and save the rule.
=AND($A2<>"",COUNTIF($A$2:$A$8,$A2)>1)

The formula checks the employee ID in column A. When an ID appears more than once, Excel applies the selected formatting to the corresponding row across columns A to C.

The additional condition excludes empty employee ID cells.

6. Compare the Different Methods

MethodBest Used For
Duplicate Values ruleQuick visual identification
COUNTIF formulaCreating a duplicate status column
Expanding COUNTIF rangeIdentifying repeat occurrences only
Formula-based conditional formattingHighlighting entire records

7. Common Duplicate Detection Problems

Extra spaces in cells

Text values containing unwanted spaces may not match as expected. Create a helper column and use the TRIM function to clean ordinary extra spaces before checking for duplicates.

=TRIM(A2)

Incorrect cell references

Ensure that the COUNTIF comparison range remains fixed when copying your formula. Dollar signs in references such as $A$2:$A$8 prevent the range from shifting.

Blank cells

Use an additional condition when you want to exclude blank cells from duplicate detection.

=IF(A2="","",IF(COUNTIF($A$2:$A$8,A2)>1,"Duplicate","Unique"))

Incorrect comparison column

Repeated employee names are not necessarily duplicate records. Two different employees may have the same name. Use an appropriate unique identifier, such as an employee ID or invoice number, when reviewing records.

8. Frequently Asked Questions

Can I highlight duplicates without deleting them?

Yes. Conditional formatting highlights repeated values while preserving the original spreadsheet data.

Does Excel COUNTIF distinguish uppercase and lowercase letters?

No. COUNTIF is not case-sensitive. For example, "APPLE" and "apple" are normally treated as matching values.

Can I highlight duplicates in Excel 2016 and Microsoft 365?

Yes. The desktop conditional formatting and COUNTIF methods described in this guide are available in Excel 2016 and newer desktop versions, including Microsoft 365. Menu layouts may vary by version and platform.

What is the difference between highlighting and removing duplicates?

Highlighting identifies repeated data without deleting it. Removing duplicates deletes entries from the selected data range according to the columns you choose. Always review and back up important records before removing them.

Conclusion

Finding duplicates in Excel is an essential spreadsheet skill. Conditional formatting is suitable for quick visual checks, while COUNTIF formulas provide greater control over how repeated entries are identified.

Choose the method that matches your requirements and review duplicate records before making permanent changes to your data.

Official References


SheetSmart Guide — Work Smarter. Save Time. Learn More.

Comments

Popular posts from this blog

How to Use SUMIFS in Excel to Sum by Department and Status

How to Freeze Rows and Columns in Excel (Step-by-Step Guide)