# How to check if two cells match in Excel

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

**Excel:** `=IF(B2=C2,"Match","Mismatch")` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D |
| --- | --- | --- | --- |
| SKU | System count | Shelf count | Match? |
| P-101 | 120 | 120 |  |
| P-102 | 45 | 44 |  |
| P-103 | 300 | 300 |  |
| P-104 | 18 | 21 |  |
| P-105 | 75 | 75 |  |
| P-106 | 9 | 9 |  |

Formula in D2, filled to D7: `=IF(B2=C2,"Match","Mismatch")`

Result: Match; Mismatch; Match; Mismatch; Match; Match

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

## Other ways

- `=IF(B2=C2,"Match","Off by "&C2-B2)`: Shows the difference when the counts disagree. (Shows "Off by -1" and "Off by 3".)
- `=B2=C2`: The 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)`.

## 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))`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/check-if-two-cells-match
