How to compare two columns in excel for duplicates
Tutor 5 (99 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To compare two columns in Excel for duplicates, use formulas, Conditional Formatting, or built-in filtering tools, depending on whether the task requires visual highlighting, logical results, or data extraction.
Method 1: Compare Two Columns Using the COUNTIF Function
What does COUNTIF do in duplicate comparison?
COUNTIF counts how many times a value appears in a specified range and confirms duplication when the count is greater than zero.
When is this method appropriate?
This method is appropriate when a logical result, such as "Duplicate" or "Unique," is required in a helper column.
Steps
Select an empty cell adjacent to the first column.
Enter the formula below.
Press Enter.
Drag the formula down to apply it to the remaining cells.
\texttt{=COUNTIF(B:B, A1)}
How to interpret the result
A value greater than 0 confirms that the value in Column A exists in Column B.
A value equal to 0 confirms that the value does not exist in Column B.
Windows and Mac differences
No functional difference exists. The formula syntax is identical on both platforms.
Method 2: Compare Two Columns Using IF and COUNTIF
Why combine IF with COUNTIF?
This combination returns readable labels instead of numeric counts.
Steps
Select an empty helper column.
Enter the formula below.
Copy the formula down the column.
\texttt{=IF(COUNTIF(B:B, A1)>0, "Duplicate", "Unique")}
Result logic
"Duplicate" confirms presence in both columns.
"Unique" confirms absence in the compared column.
Method 3: Highlight Duplicates Using Conditional Formatting
What does Conditional Formatting do in this context?
Conditional Formatting visually highlights values appearing in both columns.
Steps
Select the first column.
Open Conditional Formatting.
Choose New Rule.
Select Use a formula to determine which cells to format.
Enter the formula below.
Apply a fill color.
Confirm the rule.
\texttt{=COUNTIF(B:B, A1)>0}
Result
Cells in the selected column that appear in the compared column receive the chosen formatting.
Windows and Mac differences
Menu names remain consistent. Ribbon layout differs slightly on Mac.
Method 4: Compare Two Columns Using MATCH
What does MATCH provide?
MATCH returns the position of a matching value and confirms duplication when a match exists.
Steps
Insert a helper column.
Enter the formula below.
Fill in the column.
\texttt{=ISNUMBER(MATCH(A1, B:B, 0))}
Result interpretation
TRUE confirms duplication.
FALSE confirms uniqueness.
Method 5: Extract Duplicates Using FILTER and COUNTIF (Excel 365)
Why use FILTER?
FILTER returns only matching values without helper columns.
Steps
Select an empty cell.
Enter the formula below.
Press Enter.
\texttt{=FILTER(A:A, COUNTIF(B:B, A:A)>0)}
Result
A dynamic list of values present in both columns is returned.
Windows and Mac differences
This function requires modern Excel versions on both platforms.
Which method is best for large datasets?
COUNTIF, combined with Conditional Formatting, performs efficiently for visual checks.
FILTER performs best for dynamic extraction tasks.
Does Excel provide a built-in duplicate comparison tool across two columns?
No. Excel provides single-range duplicate detection. Cross-column comparison requires formulas or formatting rules.
Common errors to avoid
Using inconsistent data types between columns.
Including extra spaces that alter value matching.
Applying absolute references incorrectly.
Forgetting to lock ranges when copying formulas.
Key accuracy considerations
Exact text matching is case-insensitive.
Numerical values follow strict equality.
Blanks are ignored by COUNTIF.
Data reliability notes
Microsoft documentation confirms COUNTIF, MATCH, and FILTER for duplicate detection.
Spreadsheet performance benchmarks show COUNTIF efficiency below 100,000 rows.
Practical application scenarios
Inventory reconciliation
Transaction matching
Customer record validation
List comparison audits
Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to freeze a row in excel
Answers · 1
How to freeze the top three rows in excel
Answers · 1
How to freeze the top two rows in excel
Answers · 1
How to freeze top row excel mac
Answers · 1