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

Data Analysis

  • Calculate Conditional Percentile ‘IF’ in table in Excel
  • How To Insert and Customize Sparklines in Excel
  • How to Create Area Chart in Excel
  • How to create Checklist in Excel
  • How to calculate average last N values in a table in Excel

References

  • INDEX function: Description, Usage, Syntax, Examples and Explanation
  • Lookup entire row in Excel
  • How to get first row number in range in Excel
  • To count total rows in a range in Excel
  • Two-way lookup with VLOOKUP in Excel

Data Validations

  • Excel Data validation don’t exceed total
  • Excel Data validation only dates between
  • Excel Data validation whole percentage only
  • Excel Data validation with conditional list
  • Excel Data validation exists in list

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

  • IF with wildcards in Excel
  • AND function: Description, Usage, Syntax, Examples and Explanation
  • SWITCH function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel NOT Function
  • How to use IFS function in Excel

Date Time

  • Count birthdays by month in Excel
  • Convert Excel time to decimal hours in Excel
  • Calculate series of dates by workdays in Excel
  • Display Date is same month in Excel
  • How to get number of days, weeks, months or years between two dates in Excel

Grouping

  • Calculate conditional mode with criteria in Excel
  • Group times into 3 hour buckets in Excel
  • Group arbitrary text values in Excel
  • How to randomly assign data to groups in Excel
  • Group times into unequal buckets in Excel

General

  • How to get Excel workbook path only
  • 231 Keyboard Shortcut Keys In Excel
  • How to get original price from percentage discount in Excel
  • Subtotal by color in Excel
  • How to calculate profit margin percentage in Excel
© 2026 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning