ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Data tools
  3. Find Duplicates Between Two Columns in Excel

Find Duplicates Between Two Columns in Excel

By ExcelReady Team·Updated November 2, 2026·6 min read

The short answer

To find duplicates between two columns in Excel, check each value in the first column against the second with COUNTIF: =COUNTIF($B$2:$B$9,A2)>0 returns TRUE when A2 also appears in column B. Fill it down, or use the same test as a conditional formatting rule to highlight the matches. In Excel 2021 or Microsoft 365, FILTER can list them all.

Key takeaways

  • COUNTIF($B$2:$B$9,A2)>0 is TRUE when the value in A2 also appears anywhere in column B.
  • Use the same formula in a conditional formatting rule to highlight matches without a helper column.
  • The built-in Duplicate Values rule also flags repeats inside one column, so it can overcount.
  • FILTER(A2:A9,COUNTIF(B2:B9,A2:A9)>0) lists every value found in both columns.
  • For rows that repeat across two columns together, use COUNTIFS on both columns.
On this page+
  1. The sample data
  2. How to find duplicates in two columns with COUNTIF
  3. How to highlight duplicates between two columns
  4. List the duplicates with FILTER
  5. Count how many values are in both columns
  6. Find rows where two columns repeat together
  7. Why duplicates are not found
  8. Practise it

To find duplicates in two columns in Excel, check every value in one column against the other with COUNTIF: =COUNTIF($B$2:$B$9,A2)>0 returns TRUE when the value in A2 also appears in column B. You can show the result in a helper column, highlight it with conditional formatting, or list all matches with FILTER. This guide is for anyone matching customer lists, applicants or IDs from two sources.

The sample data#

The examples use two customer lists: the customer IDs who ordered in March (column A) and in April (column B). The question is which customers ordered in both months.

AB
1MarchApril
2C-101C-102
3C-104C-104
4C-107C-109
5C-110C-112
6C-112C-118
7C-115C-121
8C-118C-125
9C-120C-130

Three IDs appear in both columns: C-104, C-112 and C-118. Notice that C-112 and C-118 are on different rows in each column. A row-by-row check would miss them, so you need a formula that searches the whole other column.

How to find duplicates in two columns with COUNTIF#

COUNTIF counts how many times a value appears in a range. If a March ID appears in the April column at least once, it is a duplicate between the columns. In C2, type:

Excel formula
=COUNTIF($B$2:$B$9,A2)>0

Fill it down to C9 (Windows: Ctrl+D; Mac: ⌘D). Rows 3, 6 and 8 show TRUE; the rest show FALSE.

  • $B$2:$B$9 is the column to search. The $ signs lock it, so it doesn't move as you fill down.
  • A2 is the value to look for. It has no $, so it becomes A3, A4 and so on.
  • >0 turns the count into TRUE or FALSE.

For a clearer label, wrap it in IF: =IF(COUNTIF($B$2:$B$9,A2)>0,"In both","March only"). To check the other direction, which April customers were also in March, use =COUNTIF($A$2:$A$9,B2)>0 in column D. The COUNTIF function guide covers the syntax.

How to highlight duplicates between two columns#

Conditional formatting colours the matching cells, so you don't need a helper column. Use a formula rule:

  1. Select A2:A9.
  2. Go to Home > Conditional Formatting > New Rule.
  3. Choose Use a formula to determine which cells to format.
  4. Enter =COUNTIF($B$2:$B$9,A2)>0.
  5. Click Format, pick a fill colour and click OK.

C-104, C-112 and C-118 in column A turn coloured. To colour the matches in column B too, select B2:B9 and add a second rule with =COUNTIF($A$2:$A$9,B2)>0. Write the formula for the first selected cell (A2 or B2); Excel adjusts it for the other rows.

You may see the built-in rule Highlight Cells Rules > Duplicate Values. If you select both columns and use it, Excel colours any value that appears twice anywhere in the selection, including a value repeated inside one column. For "in both columns", the formula rule is more accurate. The guide to highlighting duplicates compares both rules in detail.

List the duplicates with FILTER#

FILTER returns only the rows that meet a condition, so it can list every value found in both columns. It needs Excel 2021 or Microsoft 365. In an empty cell, type:

Excel formula
=FILTER(A2:A9,COUNTIF(B2:B9,A2:A9)>0)

The result spills into three cells: C-104, C-112, C-118. Here COUNTIF checks all eight March IDs at once and FILTER keeps the ones with a count above 0.

Flip the test to =0 to list the March customers who did not order in April: C-101, C-107, C-110, C-115 and C-120. The guide on how to compare two lists shows more ways to spot what is missing from each list.

Count how many values are in both columns#

To get one number instead of a list, add up the matches with SUMPRODUCT:

Excel formula
=SUMPRODUCT(--(COUNTIF(B2:B9,A2:A9)>0))

The result is 3. The -- turns each TRUE into 1 and each FALSE into 0, and SUMPRODUCT adds them. This works in every version of Excel without special keys. If you have a helper column of TRUE and FALSE, =COUNTIF(C2:C9,TRUE) gives the same answer. For counting repeats inside a single column, see how to count duplicates.

Find rows where two columns repeat together#

Sometimes "duplicates in two columns" means something else: rows where the pair of values appears more than once. In an attendance log, the same employee and the same date twice is a double entry, but the same employee on different dates is fine.

AB
1EmployeeDate
2Ana3-Mar
3Ben3-Mar
4Ana4-Mar
5Ana3-Mar
6Ben5-Mar

COUNTIFS checks both columns at once. In C2, type and fill down:

Excel formula
=COUNTIFS($A$2:$A$6,A2,$B$2:$B$6,B2)>1

Rows 2 and 5 return TRUE: Ana on 3-Mar appears twice. Row 4 is Ana on a different date, so it is FALSE. To delete the extra rows, use Data > Remove Duplicates with both columns ticked; it keeps the first copy. Logs like this are common in an attendance tracker and a job application tracker, where double entries skew the counts.

Why duplicates are not found#

If a value looks the same in both columns but the formula says FALSE, the two cells hold different characters. Check these:

  • Extra spaces. "C-104 " with a trailing space doesn't match "C-104". Clean both columns with TRIM, or compare with =COUNTIF($B$2:$B$9,TRIM(A2))>0 if only column A is messy.
  • Very long numbers. COUNTIF treats text that looks like a number as a number, and Excel keeps only 15 digits. Two different 16-digit account numbers stored as text can then count as a match. For long IDs, use =SUMPRODUCT(--($B$2:$B$9=A2))>0, which compares the full text.
  • Different formats. "C-104" and "C104" are different values. Use SUBSTITUTE to remove the dash from both before comparing.
  • Wildcards. COUNTIF treats * and ? in the value as wildcards, so a value like "A*" can match many cells. Rare in IDs, but worth knowing.

COUNTIF ignores capital letters, so "c-104" and "C-104" count as a match. That is usually what you want.

Practise it#

Try the exercise on this page: it checks whether one March customer also ordered in April. Then practise COUNTIF in a live spreadsheet, where you type each formula and it checks it instantly, and use the conditional formatting lesson to highlight duplicate IDs with a formula rule.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Does the customer in A3 also appear in the April list? Click C3 and use COUNTIF to check A3 against B2:B9, adding >0 to get TRUE or FALSE.

fx
ABCD
1
March
April
In both?
2
C-101
C-102
3
C-104
C-104
4
C-107
C-109
5
C-110
C-112
6
C-112
C-118
7
C-115
C-121
8
C-118
C-125
9
C-120
C-130
10
11
12

Tip: COUNTIF counts how many times A3 appears in B2:B9. Any count above 0 means it is in both lists.

Practise this in a lesson

LessonCOUNTIFCount the cells that match a condition, from exact words to number checks like ">=8".LessonConditional formattingMake important numbers stand out: highlight values over a limit, duplicate IDs and the top 3, then color whole rows with a formula rule and a $ on the column.Function guideCOUNTIFCount cells that match one condition with COUNTIF: text, numbers, wildcards and cell references. Real examples and a live exercise.

Frequently asked questions

How do I find duplicates in two columns in Excel?

+

In a helper column, type =COUNTIF($B$2:$B$9,A2)>0 next to the first value and fill it down. TRUE means the value in column A also appears in column B.

How do I highlight duplicates between two columns?

+

Select the first column, go to Home > Conditional Formatting > New Rule, choose Use a formula, and enter =COUNTIF($B$2:$B$9,A2)>0. Every value that also appears in column B gets the fill colour.

How do I find duplicates across two columns in the same row?

+

Compare the two cells directly with =A2=B2, which returns TRUE when the row matches. To flag rows where the pair of values repeats further down the list, use =COUNTIFS($A$2:$A$9,A2,$B$2:$B$9,B2)>1.

Why doesn't Excel find duplicates that look the same?

+

One of the values probably has an extra space or is a number stored as text. Clean the columns with TRIM, or convert text numbers with VALUE, and the matches will appear.

Sources

  • COUNTIF function - Microsoft Support
  • Use conditional formatting to highlight information - Microsoft Support
  • FILTER function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. The sample data
  2. How to find duplicates in two columns with COUNTIF
  3. How to highlight duplicates between two columns
  4. List the duplicates with FILTER
  5. Count how many values are in both columns
  6. Find rows where two columns repeat together
  7. Why duplicates are not found
  8. Practise it

Keep reading

Data tools· 6 min read

Find and Highlight Duplicates in Excel

To highlight duplicates in Excel, select the cells, go to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values, and click OK. Every value that appears more than once turns red. To flag or count repeats with a formula instead, use COUNTIF: =COUNTIF($A$2:$A$9,A2)>1 is TRUE for a duplicate.

Lookups· 5 min read

How to Compare Two Lists in Excel

To compare two lists in Excel, use COUNTIF to check whether each item in one list appears in the other: =IF(COUNTIF($C$2:$C$6,A2)>0,"Yes","No"). To list the missing items in one go, use FILTER with COUNTIF. To see the differences at a glance, add a conditional formatting rule that highlights items with no match.

Conditional math· 6 min read

How to Count Duplicates in Excel

To count duplicates in Excel, use COUNTIF. =COUNTIF($A$2:$A$8,A2) shows how many times the value in A2 appears; any result above 1 is a duplicate. To count every row that is part of a duplicate set in one cell, use =SUMPRODUCT(--(COUNTIF(A2:A8,A2:A8)>1)). Decide first whether you need repeated rows, extra copies or repeated values.

More on data tools

  • How to Filter Data in Excel (Ctrl+Shift+L)
  • How to Make a Frequency Table in Excel
  • How to Highlight Blank Cells in Excel
  • Highlight Cells That Contain Specific Text
  • Highlight an Entire Row Based on a Cell Value
  • Highlight the Top 10 Values in Excel
All data tools articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free