Spreadsheet Practice

How to check if two cells match in Excel

Formula (Excel and Google Sheets)

=IF(B2=C2,"Match","Mismatch")

Compare them with =: =IF(B2=C2,"Match","Mismatch"). Use EXACT when upper and lower case must match too.

Result on the example
one result per row in D2, filled down to D7
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in D2, filled down to D7. Change any input and the result updates, or edit the formula to experiment.

How it works

B2=C2 is TRUE when the two cells hold the same value, and IF turns it into a label. Filling down compares each row with itself, so this is also how you compare two columns row by row.

=IF(B2=C2,"Match","Mismatch")

Result"Match"

  1. B2120

    The value in B2.

  2. C2120

    The value in C2.

  3. B2=C2TRUE

    The = operator tests whether the two sides are equal.

  4. IF(B2=C2,"Match","Mismatch")"Match"

    IF: Returns one value if a test is true, another if false.

    • logical_testB2=C2TRUE
    • value_if_true"Match"
    • value_if_false"Mismatch"not used

In Google Sheets

The same formula works in Google Sheets: =IF(B2=C2,"Match","Mismatch"). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=IF(B2=C2,"Match","Off by "&C2-B2)Match, Off by -1, Match…Different resultShows the difference when the counts disagree. Shows "Off by -1" and "Off by 3".
=B2=C2TRUE, FALSE, TRUE…Different resultThe bare comparison returns TRUE or FALSE, ready for filtering or conditional formatting. TRUE and FALSE instead of labels.

Common mistakes

  • A number and the same number stored as text ("120") are not equal. Convert imported columns first.
  • Text comparisons ignore case but not spaces: "Box" and "box " differ. Use EXACT for case and TRIM for spaces.
  • Calculated values can differ in a far decimal place even when they display the same. Compare ROUND(B2,2)=ROUND(C2,2).

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Check if two cells match

In D2, show "Match" when the system count equals the shelf count, otherwise "Mismatch". Fill down to D7.

Questions

How do I compare two cells case-sensitively?

=IF(EXACT(B2,C2),"Match","Mismatch").

How do I count the mismatches?

=SUMPRODUCT(--(B2:B7<>C2:C7)).

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.