Skip to main content

Count matches between two columns in Excel

For example, I have two lists of data in column A and column C, now, I want to compare the two columns and count if the value in column A found in column C in the same row as below screenshot shown. In this case, the SUMPRODUCT function may be the best function for you to solve this task in Excel.

Count matches between two columns with SUMPRODUCT function

Count matches between two columns with SUMPRODUCT function

To compare two columns and count the matches in each row, the SUMPRODUCT function in excel may do you a favor. The generic syntax is:

  • range1, range2: The two ranges of cells that you want to compare. The ranges must be the same size.

Please enter or copy the below formula into a blank cell to output the result, and then press Enter key to get the calculation, see screenshot:


Explanation of the formula:


  • A2:A12=C2:C12: This expression compares the values in range A2:A12 with the values in range C2:C12 for each row, if the two values in the same row are equal, TRUE will display, otherwise, FALSE is displayed, so, you will get the array like this: {FALSE;TRUE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;TRUE}.
  • --(A2:A12=C2:C12)= --({FALSE;TRUE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;TRUE}): :-- this double negative sign converts the TRUE and FALSE into 1 and 0, returns the result as this: {0;1;0;0;0;1;0;0;1;0;1}.
  • SUMPRODUCT(--(A2:A12=C2:C12))= SUMPRODUCT({0;1;0;0;0;1;0;0;1;0;1}):: The SUMPRODUCT function sums all values in the array, and get the result:4.


If you need to count the non-matching values between the two columns, please apply this formula:


Relative function used:

  • The SUMPRODUCT function can be used to multiply two or more columns or arrays together, and then get the sum of products.

More articles:

  • Count number of cells not equal to many values in Excel
  • In Excel, you may easily get the number of cells not equal to a specific value by using the COUNTIF function, but have you ever tried to count the cells which are not equal to many values? For example, I want to get the total number of the products in column A but exclude the specific items in C4:C6 as below screenshot shown. This article, I will introduce some formulas for solving this job in Excel.
  • Count Number Of Cells Contain Numeric Or Non-Numeric Values
  • If you have a range of data which contains both numeric and non- numeric values, and now, you may want to count the number of numeric or non-numeric cells as below screenshot shown. This article, I will talk about some formulas for solving this task in Excel.

The Best Office Productivity Tools

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations