Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Conditional Formatting Color Scales Examples in Excel
  • Conditional Formatting New Rule with Formulas in Excel
  • How to Create Column Chart in Excel
  • How To Perform and Interpret Regression Analysis in Excel
  • How to calculate current stock or inventory in Excel

References

  • INDEX function: Description, Usage, Syntax, Examples and Explanation
  • How to get relative row numbers in a range in Excel
  • Offset in Excel
  • How to get address of last cell in range in Excel
  • How to use Excel TRANSPOSE Function

Data Validations

  • Data validation must not exist in list
  • Excel Data validation date in next 30 days
  • Excel Data validation unique values only
  • Excel Data validation only dates between
  • How To Create Drop-down List in Excel

Count matches between two columns in Excel

by

This tutorial shows how to Count matches between two columns in Excel using the example below;

Formula

=SUMPRODUCT(--(range1=range2))

Explanation

If you want to compare two columns and count matches in corresponding rows, you can use the SUMPRODUCT function with a simple comparison of the two ranges. For example, if you have values in B5:B11 and C5:C11 and you want to count any differences, you can use this formula:

=SUMPRODUCT(--(B5:B11=C5:C11))

How this formula works

The SUMPRODUCT function is a versatile function that handles arrays natively without any special array syntax. Its behavior is simple: it multiplies, then sums the product of arrays. In the example shown, the expression B5:B11 = C5:C11 will generate an array that contains TRUE and FALSE values like this:

{TRUE;TRUE;FALSE;TRUE;FALSE;FALSE;FALSE}

Note that we have 3 TRUE values because there are 3 matches.

In this state, SUMPRODUCT will actually return zero because TRUE and FALSE values are not counted as numbers in Excel by default. To get SUMPRODUCT to treat TRUE as 1 and FALSE as zero, we need to “coerce” them into numbers. The double negative is a simple way to do that:

--(B5:B11=C5:C11)

After coercion, we have:

{1;1;0;1;0;0;0}

With no other arrays to multiply, SUMPRODUCT simply sums the values and returns 3.

Count non-matching rows

To count non-matching values, you can reverse the logic like so:

=SUMPRODUCT(--(B5:B11<>C5:C11))

Post navigation

Previous Post:

How to use Excel CHOOSE Function

Next Post:

Customize Ribbon In Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • OR function Examples in Excel
  • How to use Excel OR Function
  • Excel If, Nested If, And/Or Criteria Examples
  • OR function: Description, Usage, Syntax, Examples and Explanation
  • Nested IF function example in Excel

Date Time

  • WORKDAY function: Description, Usage, Syntax, Examples and Explanation
  • Convert text date dd/mm/yy to mm/dd/yy in Excel
  • Add workdays to date custom weekends in Excel
  • Count dates in current month in Excel
  • Basic timesheet formula with breaks in Excel

Grouping

  • Group times into unequal buckets in Excel
  • Group numbers with VLOOKUP in Excel
  • Map inputs to arbitrary values in Excel
  • Calculate conditional mode with criteria in Excel
  • Running count group by n size in Excel

General

  • Using Existing Templates in Excel
  • Find, Select, Replace and Go To Special in Excel
  • Convert column number to letter in Excel
  • AutoRecover file that was never saved in Excel
  • 3D SUMIF for multiple worksheets in Excel
© 2025 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning