Note: The other languages of the website are Google-translated. Back to English

## 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:

=SUMPRODUCT(--(range1=range2))
• 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:

=SUMPRODUCT(--(A2:A12=C2:C12)) ##### Explanation of the formula:

=SUMPRODUCT(--(A2:A12=C2:C12)):

• 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.

Tips:

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

=SUMPRODUCT(--(A2:A12<>C2:C12)) #### Relative function used:

• SUMPRODUCT:
• 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

#### Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

• Designed for 1500 work scenarios, helps you solve 80% Excel problems.
• Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
• Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
• 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. #### 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, Firefox, And New Internet Explorer. 