How to Count Matches between Two Columns in Excel

This post will guide you how to Count the number of matches between two columns using a formula in Excel 2013/2016 or Excel office 365. How do I compare two columns within two different ranges or columns and count if the value in column1 found in column2 in Excel. You can use the SUMPRODUCT function to compare two columns, and is used to multiply the corresponding components in the given two ranges or arrays and returns the sum of those products.

The Syntax of the SUMPRODUCS is as below:

=SUMPRODUCT(array1,[array2]…)

For Example, you have a data of list in both A2:A6 and B2:B6 and you wish to count any differences between those two ranges, and you can use the below SUMPRODUCT function:

=SUMPRODUCT(–(A2:A6=B2:B6))

count matches between two columns1

You can select cell C1 to place the final result, just click on it, and insert the above formula, then press Enter key.

Let’s See That How This Formula Works:

count matches between two columns2

In the above example the expression A2:A6=B2:B6 will compare the value of those two ranges and generates an array result with TRUE and FALSE, like this:

{TRUE;TRUE;FALSE;TRUE;FALSE}

count matches between two columns3

If cell values are equal and returns TRUE, otherwise returns FALSE.

count matches between two columns4

The double negative operator will convert the TRUE and FALSE value into 1 and 0 and return another array result like this:

{1;1;0;1;0}

count matches between two columns5

The SUMPRODUCT function will simply sum the values in the array and return the final result.

     

Related Functions


  • Excel SUMPRODUCT function
    The Excel SUMPRODUCT function multiplies corresponding components in the given one or more arrays or ranges, and returns the sum of those products. The syntax of the SUMPRODUCT function is as below:= SUMPRODUCT (array1,[array2],…)…

 

Related Posts

Excel Array Formula

An array formula is a special formula that is converted from a normal formula by the Ctrl+Shift+Enter shortcut. Excel automatically adds curly brackets "{}" at the beginning and end of an array formula. The essence of the array formula is ...

Excel Array

What is Excel Array? In Excel functions and formulas, an array is a collection of data elements in one row, one column, or multiple rows and columns. Array elements can be numeric, text, date, logical and error values. The dimension ...

Check Cell If Contains One of Many with Exclusions

In Microsoft Excel Spreadsheet or google sheets, when cells contain multiple strings, how can we accomplish this task if you want to check whether these cells contain more than one given string and exclude other given strings? In this article, ...

Cash Denomination Calculator

Every country has different cash denominations, so you may need to calculate the number of different denominations based on the total amount. If it is just a small amount of cash, then you can calculate the different cash denominations manually, ...

Calculate Win Loss Tie

Suppose you got a task to calculate the win, loss, and tie totals; what would you do? If you are new to Ms Excel and don't have enough experience with it, then you might do this task manually but let ...

Sidebar