Are you tired of manually checking for duplicates in two columns of your Excel spreadsheet? You're not alone. This task can be time-consuming and error-prone, especially when dealing with large datasets. The good news is, Excel provides several built-in tools and functions that can help you highlight duplicates in two columns with ease. In this article, we'll explore a simple yet powerful method using Conditional Formatting and the COUNTIF function.
Understanding the Problem: Duplicates in Two Columns
When you have duplicates in two columns, it means you have the same value in both columns for multiple rows. For instance, consider the following data:
| Column A | Column B |
|---|---|
| Apple | Banana |
| Banana | Apple |
| Apple | Cherry |
| Banana | Apple |
In this example, "Apple" is a duplicate in both columns.

Preparing Your Data
Before you start, ensure your data is sorted. This will make it easier to identify and highlight duplicates. To sort your data, select any cell in your range, then go to the 'Home' tab, click 'Sort & Filter', and choose 'Sort A to Z' or 'Sort Z to A'.
Using Conditional Formatting and COUNTIF
Now, let's use Conditional Formatting and the COUNTIF function to highlight duplicates in two columns.
- Select the range you want to check for duplicates. In our case, it's A1:B5.
- Click on 'Conditional Formatting' in the 'Home' tab, then select 'New Rule'.
- In the 'New Formatting Rule' dialog box, select 'Use a formula to determine which cells to format'.
- In the 'Format values where this formula is true:' box, enter the following formula:
=COUNTIF($A$1:$A1,$A1)>1and=COUNTIF($B$1:$B1,$B1)>1. This formula counts the number of times the value in each cell appears in its respective column. If the count is greater than 1, the cell is a duplicate. - Choose the formatting you want to apply to the duplicates. For example, you can fill the cells with a color.
- Click 'OK' to apply the rule.
The duplicates in your two columns should now be highlighted. If you want to remove the duplicates, you can use the 'Remove Duplicates' feature in the 'Data' tab. Just make sure to select the columns you want to check for duplicates and click 'OK'.

What if I Have More Than Two Columns?
If you have more than two columns, you can modify the formula to check for duplicates in all columns. For example, if you have four columns (A, B, C, and D), the formula would be: =AND(COUNTIF($A$1:$A1,$A1)>1,COUNTIF($B$1:$B1,$B1)>1,COUNTIF($C$1:$C1,$C1)>1,COUNTIF($D$1:$D1,$D1)>1).
Conclusion
Highlighting duplicates in two columns in Excel is a breeze with Conditional Formatting and the COUNTIF function. This method is not only efficient but also helps you maintain the integrity of your data. So, the next time you're dealing with duplicates, don't hesitate to use this method. Happy Exceling!




![Find, Highlight, and Remove Duplicates in Excel [Step-by-Step]](https://i.pinimg.com/originals/89/60/50/89605032f9f78c2584c0db24a04e42a2.png)










![How to Highlight a Column in Excel? [Window 10 & 11 Guide] - MiniTool Partition Wizard](https://i.pinimg.com/originals/62/21/fe/6221fe089a3e2712132f93dfd57453bb.png)







