Check if Two Cells Match or Do Not Match
This article explains how to compare two cells in Excel and display “Match” if the text in both cells is the same, or “No Match” if they are different. You can easily set this up using the IF function. For example, it is useful when you want to check if the text in cells A1 and B1 is identical.
Using the IF Function to Compare Cells
The IF function allows you to display different text based on conditions. In this case, we’ll compare the contents of two cells and display “Match” or “No Match” based on the result.
Basic Formula
Use the following formula to display “Match” if the contents of A1 and B1 are identical, or “No Match” if they are not:
=IF(A1=B1, “Match”, “No Match”)
Note: The formula is =IF(A1=B1, “Match”, “No Match”), not =IF(A1==B1, …).
Example
In the table below, the text in cells A1 and B1 is compared, and the result is displayed in cell C1.
A | B | C | |
---|---|---|---|
1 | Apple | Apple | =IF(A1=B1, “Match”, “No Match”) |
2 | Grape | Orange | =IF(A2=B2, “Match”, “No Match”) |
3 | apple | Apple |
=IF(A3=B3, “Match”, “No Match”) |
Steps
- Enter the following formula in cell C1: =IF(A1=B1, “Match”, “No Match”)
- Press Enter, and cell C1 will display “Match” if the contents of A1 and B1 are identical, or “No Match” if they are different.
- Copy the formula to other cells as needed to perform the same comparison.
Results
Since A1 and B1 both contain “Apple”, C1 will display “Match”. A2 and B2 contain “Grape” and “Orange”, respectively, so C2 will display “No Match”. A3 and B3 differ in case (“apple” vs. “Apple”), but the formula considers them identical and displays “Match”.
Distinguishing Uppercase and Lowercase
The above formula does not differentiate between uppercase and lowercase letters. To make case-sensitive comparisons, you can use the EXACT function.
Example Using the EXACT Function
To check if the contents of A3 and B3 are an exact match, including case, use the following formula:
=IF(EXACT(A3, B3), “Match”, “No Match”)
Results
Since A3 and B3 differ in case, the formula will determine that they do not match and display “No Match”.
Summary
This article explained how to check if the contents of two cells in Excel match or not. By using the IF function, you can easily display “Match” or “No Match”. If you need case-sensitive comparisons, consider using the EXACT function for more precise results.