Skip to main content

How to Highlight Duplicates in Excel

Explore how you can identify duplicate entries in Excel using Conditional Formatting, the COUNTIF() formula, and Power Query. Learn best practices and troubleshoot issues.
Nov 13, 2024  · 6 min read

Whenever I work with spreadsheets, repeating information messes up my analysis and reports. Not only is it incredibly frustrating to discover duplicates after I've already presented my findings, but they often lead me to draw wrong conclusions and make poor decisions. 

After too many data mishaps, I found some great Excel tools for spotting and highlighting duplicates before they cause problems. In this article, I'll share the exact methods you can use to improve your data-cleaning process. These methods will transform your data-cleaning process just as they transformed mine. However, if you’re new to Excel, check out our Excel Fundamentals skill track to get started. 

How to Highlight Duplicates in Excel

Excel provides many methods for identifying and highlighting duplicates. Let’s understand how each one works.

Advance Your Career with Excel

Gain the skills to maximize Excel—no experience required.

Start Today for Free

Method 1: Highlight duplicates in Excel using conditional formatting

You can use conditional formatting to identify duplicates in your Excel spreadsheet. Here’s how:

  • Select the range of cells you want to check.

Selecting a range of cells before tryint to highlight duplicates in Excel

Select the range of cells. Image by Author.

  • Go to Home > Conditional Formatting > Highlight Ccells Rules > Duplicate Values.

Conditional Formatting and selecting Duplicate Values option in Excel

Select the Duplicate Values option. Image by Author.

  • A dialog box appears. From the drop-down list, select how you want to highlight the duplicates. Here, I chose Green Fill with Dark Green Text.

select a desired format to duplicate values in Excel

Apply the format. Image by Author.

  • Click OK and see the duplicate values highlighted.  

Duplicate values are highlighted using Conditional Formatting in Excel.

Duplicate values are highlighted. Image by Author.

The best thing about this approach is that you can see duplicates right away. As soon as you enter new data, Excel will automatically color it if it's a duplicate. While this method is quick and easy, it has some basic limits. For example, if you want to check for duplicates across multiple columns or find partial matches (like just matching last names), this simple highlighting won't work. 

Method 2: Highlight duplicates in Excel using the COUNTIF() formula

Here’s how you can highlight only the second and subsequent duplicate values. As a note, this method won't count the first occurrence.

  • Select the range of cells. 
  • Go to the Home tab > Conditional Formatting > New Rule.

New Rule under conditional formatting tab in excel

Setting a new rule. Image by Author.

  • Now, select the Use a formula to determine which cells to format option. Then, in the formula box, type the following formula. (Here, A2 is the first cell in the range you selected.)
=COUNTIF($A$2:$A2,$A2)>1
  • Click the Format button to choose your desired fill or font color, then select OK to apply changes.

highlighting the second occurrence of duplicates in excel

Steps to highlight the duplicates. Image by Author.

Now you can see all the duplicate cells are highlighted, excluding the first occurrences.

All the duplicates except the first occurrence are highlighted using formula in Excel

Highlighted duplicates. Image by Author.

Like the Conditional Formatting option, the formula automatically recalculates as your data changes and duplicates are identified in real-time. But here’s how the most outstanding part — you get more control over duplicate data with this method. Suppose you only want to check for duplicates in specific columns, or maybe you want to count something as a duplicate only if both the name AND email match. This method lets you do that by adjusting your formula.

Method 3: Highlight duplicates in Excel with Power Query

You can use Power Query to import and clean data from multiple sources. It’s especially helpful for handling large datasets and performing more advanced data manipulation tasks. Here’s how you can use it to highlight duplicates:

  • Select a cell or range of cells. 
  • Go to Data tab > Get & Transform Data > From Table.

Selecting the From Table option in excel

Selecting the From Table option. Image by Author.

  • A pop-up will appear. If you have a header in your data, make sure to check the My table has headers option so it doesn't count your header as data. Next, select OK.

Select the data automatically and hit ok in excel

Selecting the data automatically. Image by Author. 

  • The selected data appears on the Power Query Editor. Now, select the column you want to check for duplicates.

Power Query Editor. Image by Author.

  • Next, inside the Power Query Editor, go to the Home tab > Keep Rows and select the Keep Duplicates option. This will display all the duplicate rows of the selected column.

displaying the duplicate data using power query in excel

Showing duplicate data. Image by Author.

  • If you want to see the results in Excel rather than Power Query Editor, click Close & Load under the Close group. 

Close and Load option in excel

Close & Load. Image by Author.

This way, you can see the results in Excel.

Results in excel

Data loaded in excel sheet. Image by Author.

This approach works well with large datasets — hundreds or even thousands of rows. It's also perfect if you regularly get new data and need to check for duplicates often. Instead of doing the same work repeatedly, you set it up once, and Power Query will automatically clean up any duplicates.

Best Practices for Highlighting Duplicates in Excel

If you want to highlight duplicates in Excel, adopt a systematic approach to maintain the integrity of your data. Here are some of my best practices that you can follow:

  • Before making any modifications, always backup your data. This ensures you have a safety net to revert to.
  • Standardize all text cases, spaces, dates, numbers, and special characters to maintain consistent formatting.
  • Set data validation rules, including dropdown lists, warning messages, required fields, value ranges, and documented procedures to prevent duplicates at the entry point.

Troubleshooting Common Excel Duplicate Issues

Even with the right methods, you can encounter a couple of challenges while highlighting duplicates. While the following functions aren't necessary for you to find duplicates per se, knowing them can help you fix common issues.

Duplicates not highlighted

Sometimes, values with identical names aren't highlighted due to hidden characters or extra spaces. To solve this issue, use the TRIM() and CLEAN() functions together. TRIM() will remove unnecessary spaces from the text's beginning, end, and middle, while CLEAN() will eliminate non-printable characters. 

Case sensitivity

Excel is case-sensitive. It treats uppercase and lowercase letters as different characters, such as DATACAMP, DataCamp, Datacamp, and datacamp, which would be considered different entries. To solve this, you can use the UPPER(), LOWER() and PROPER() functions. Here’s what each function does:

  • UPPER() converts text to uppercase. 

  • LOWER() converts text to lowercase.

  • PROPER() capitalizes the first letter of each word.

Final Thoughts

Regular duplicate checks maintain data integrity and prevent analysis errors. While Excel has several approaches to highlighting duplicates, I encourage you to experiment with different methods to find what best suits your needs.

If you want to strengthen your data handling expertise further, check out our Data Analysis in Excel course and Data Analysis with Excel Power Tools skill track.

Learn Excel Fundamentals

Gain skills to use Excel effectively—no experience required.

Photo of Laiba Siddiqui
Author
Laiba Siddiqui
LinkedIn
Twitter

I'm a content strategist who loves simplifying complex topics. I’ve helped companies like Splunk, Hackernoon, and Tiiny Host create engaging and informative content for their audiences.

Common Questions About Highlighting Excel Duplicates

Can I remove duplicates in Excel instead of just highlighting them?

Yes, you can. To do so, select the range of cells and go to the Data tab. Then, select the Remove duplicates option in the Data tool section to eliminate duplicates.

How do I highlight duplicates using keyboard shortcut keys?

Select the range of cells, then press Alt →H→L→H→D to apply the conditional formatting rule to 

duplicate values.

How do I filter for unique values in Excel?

Select your data range. Go to Data > Advanced. From there, choose Filter the list, in-place option to display unique values in the same range, or Copy to another location and specify a cell to place them. Then, check Unique records only and click OK.

Topics

Learn Excel with DataCamp

course

Data Preparation in Excel

3 hr
34.7K
Understand how to prepare Excel data through logical functions, nested formulas, lookup functions, and PivotTables.
See DetailsRight Arrow
Start Course
See MoreRight Arrow
Related

tutorial

How to Compare Two Columns in Excel: A Step-by-Step Guide

Learn how to compare two columns in Excel for matches and for duplicates using methods like the equals operator, IF() function, EXACT(), VLOOKUP(), and more.
Laiba Siddiqui's photo

Laiba Siddiqui

9 min

tutorial

How to Clean Data in Excel: A Beginner's Guide

Learn essential data cleaning techniques in Excel, including removing duplicates, handling missing values, and maintaining consistent formatting.
Laiba Siddiqui's photo

Laiba Siddiqui

15 min

tutorial

Conditional Formatting in Excel: A Beginner’s Guide

Explore conditional formatting in Excel with simple to advanced examples and their best practices.
Joleen Bothma's photo

Joleen Bothma

7 min

tutorial

Conditional Formatting in Spreadsheets

Learn how to utilize conditional formatting with one or multiple conditions and how to color cells by custom criteria with the help of a dataset.
Aditya Sharma's photo

Aditya Sharma

11 min

tutorial

How to Combine VLOOKUP() with IF() in Excel

Combine VLOOKUP() with IF() for efficient data analysis, including conditional lookups, error handling, and dynamic column indexing.
Laiba Siddiqui's photo

Laiba Siddiqui

10 min

tutorial

How to Do a VLOOKUP() with Multiple Criteria

Master the art of using VLOOKUP() with multiple criteria in Excel. Explore advanced techniques like helper columns and the CHOOSE() function.
Laiba Siddiqui's photo

Laiba Siddiqui

10 min

See MoreSee More