How to Count Matches in Two Columns in Excel (3 Practical Methods)

Suppose you have the following dataset.

1- How to Count Matches in Two Columns in Excel


Watch Video – Count Matches in Two Columns in Excel



Method 1 – Count Matches in Two Columns (Match Side-by-Side)

Using the SUM Function

Steps:

  • Insert the following formula in the relevant cell (F5 in this example).
=SUM(--(B6:B20 = C6:C20))
  • Hit Enter.

3- Using the SUM function to count matches between two columns row-wise

=$B6=$C6

4- Applying conditional formatting to highlight matches between two columns row-wise


Using the SUMPRODUCT Function

Steps:

  • Insert the following formula in the relevant cell (F6 in this example).
=SUMPRODUCT(--(B6:B20 = C6:C20))
  • Hit Enter.

5- Applying the SUMPRODUCT function to count matches between two columns row-wise


Combining Excel EXACT and IF Functions for Case-Sensitive Match

Steps:

  • Add a helper column to use these functions.

6- Inserting a helper column to count matches in two columns row-wise and case-wise

  • Use the following formula in the relevant cell (D6 in this example).
=IF(EXACT(B6,C6),"Common","Unique")
  • Use the Auto Fill tool to copy the formula to the other cells of the column.

This formula will return ‘Unique’ if it doesn’t get exact values with the same case, and return ‘Common’ if it gets exact values with the same case.

7- Joining the IF and EXACT functions to identify matches in two columns row-wise and case-wise

  • Use the following formula to count the matching values.
=COUNTIF(D6:D20,"Common")

8- Using the COUNTIF function to count matches in two columns row-wise and case-wise


Method 2 – Count Matches in Two Columns (Not Side by Side)

Combining Excel SUMPRODUCT & COUNTIF Functions

Steps:

  • Insert the following formula in the relevant cell (F6).
=SUMPRODUCT(COUNTIF(B6:B20,C6:C20))
  • Press Enter.

9- Combining SUMPRODUCT & COUNTIF functions to count matches in two columns from any position

  • Use individual conditional formatting to highlight duplicates of each item with different colors.

10- Applying conditional formatting to highlight matches of each item with different color


Merging Excel SUMPRODUCT, ISNUMBER & MATCH Functions

Steps:

  • Insert the following formula in the relevant cell (F6).
=SUMPRODUCT(--(ISNUMBER(MATCH(C6:C20,B6:B20,0))))
  • Press Enter.

11- Combining SUMPRODUCT, ISNUMBER & MATCH functions to count matches in two columns from any position


Joining the COUNT & MATCH Functions

Steps:

  • Insert the following formula in the relevant cell (F6).
=COUNT(MATCH(C6:C20,B6:B20,0))
  • Press Enter.

12- Combining COUNT & MATCH functions to count matches in two columns from any position

 


Method 3 – Count Individual Total Match

Steps:

  • Insert the following formula in the relevant cell (F6).
=COUNTIF($C$6:$C$20,E6)
  • Press Enter.

14- Applying the COUNTIF function to count the number of individual matches

  • Use conditional formatting to highlight the matches.

15- Using conditional formatting to highlight the individual matches of each item

  • Create a drop-down list for a more dynamic selection of the results.

16- Using a drop-down list to select an item from the name list


Download Practice Workbook

You can download our free practice workbook to practice the methods.


<< Go Back to Columns | Compare | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Nehad Ulfat
Nehad Ulfat

NEHAD ULFAT is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including ABACUS, AutoCAD, Rhinoceros, Maxsurf, and Hydromax. He got his B.Sc in Naval Architecture & Marine Engineering from BUET but switched gears, working as a content developer.  In this role, he creates techy content all about Excel... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo