To compare two cells, use =A1=B1. It returns TRUE when the values match and FALSE when they don’t.
This ignores case, so “Apple” and “apple” both come back TRUE — use =EXACT(A1,B1) when case matters, which returns FALSE for that pair. For a readable result rather than TRUE/FALSE, wrap either in IF: =IF(A1=B1,"Matched","Not Matched").
To compare two whole columns, enter the formula in the first row and drag it down, or use =IF(EXACT(A1,B1),"","Check") so only the mismatches are flagged.
If two cells look identical but return FALSE, the cause is almost always an invisible trailing space or a number stored as text — test with =TRIM(A1)=TRIM(B1) to rule out the first, and =ISNUMBER(A1) against =ISNUMBER(B1) for the second.
To highlight differences rather than label them, select both columns and use Home → Conditional Formatting → New Rule → Use a formula, with =$A1<>$B1 as the rule.
To compare two cells in Excel, you can use the equal operator by referring to both cells. If both values are the same, the result will be TRUE, and if they are not, it will be FALSE. In the following example, we have two values in cells A1 and B1, and now you need to compare both cells.

In this tutorial, we will learn about the different methods that you can use.
Compare Two Cells using Equals Operator
To compare two cells using the equals operator, you can use a simple formula that checks for equality between the values in the specified cells.

This formula can be entered into any cell where you want the result displayed. For instance, if you want to compare the values in cells A1 and B1, you would enter the formula =A1=B1 in another cell. Here are the simple steps for this:
- First, in cell C1, enter the equal operator to start the formula.
- After that, refer to cell A1, where we have the first value.
- Next, enter the equal operator to compare values from the cells.
- Now, refer to cell B1, where you have the second value.
- In the end, hit enter to get the result.
As you can see, the result is FALSE, which means the values in the cells are not the same. But if you change the value in cell B1 to match the value in A1 (like “Yes”), the result will be TRUE.

So, this is a simple and quick way to compare two cells and get the result as TRUE or FALSE.
=A1=B1
Using the equals operator to compare text is not case-sensitive. If you compare two text values with different cases, such as “Apple” in cell A1 and “apple” in cell B1, the formula =A1=B1 will return TRUE because Excel treats them as equal regardless of their case.
Using EXACT Function to Match Text Values from Two Cells
There’s also a function in Excel that you can use, and that’s EXACT. The EXACT function matches the text values from two cells, and unlike the equals operator, it’s case-sensitive. You just need to refer to the cells you want to compare, and it returns TRUE or FALSE.
We are using the same example:
- First, in cell C1, enter the EXACT function.
- After that, refer to cell A1.
- Next, enter a comma.
- Now, refer to cell B1.
- In the end, enter the closing parenthesis and hit enter to get the result.

The result is FALSE, as the values in cells A1 and B1 are not the same.
=EXACT(A1,B1)
Using the IF Function to Create a Condition to Compare Cells, Rows, and Columns
In both methods that we have discussed above, we get the result TRUE or FALSE, but what if you want to have a custom result for both cases? In that case, you can use the IF function to create a condition and get a custom result.
- First, in cell C1, enter the IF function.
- After that, we will compare cells in the same way that we used in the first method.
- Next, in the function’s second argument, enter the value you want to get if both values match.
- Now, in the third argument of the function, enter the value you want to get if both values do not match.
- In the end, enter the closing parenthesis to close the function and hit enter.

As you can see, in the result, we have the value “Not Matched,” as values in both of the cells are not the same.
=IF(A1=B1,"Matched","Not Matched")
If you want a custom result and a case-sensitive match at the same time, use EXACT inside IF:
=IF(EXACT(A1,B1),"Matched","Not Matched")
Why Two Cells Look the Same but Don’t Match
Sometimes, you get FALSE even though both cells look the same. These are the usual reasons:
- Extra spaces: “Apple ” with a space at the end isn’t equal to “Apple”. Use TRIM on both cells (first formula below this list).
- Number stored as text: the number 25 isn’t equal to the text “25”. Convert the text with VALUE (second formula below this list).
- Hidden decimals: a cell can show 1 but hold 1.0000001. Compare the difference with a small tolerance (third formula below this list).
=TRIM(A1)=TRIM(B1)
=A1=VALUE(B1)
=ABS(A1-B1)<0.001
Compare More Than Two Cells
To check if three or more cells have the same value, combine the comparisons with AND. Or, for a longer row, count how many cells match the first one with COUNTIF and compare that with the number of cells:
=AND(A1=B1,B1=C1)
=COUNTIF(A1:E1,A1)=COLUMNS(A1:E1)
Both formulas return TRUE only when all the cells are the same. Like the equals operator, COUNTIF isn’t case-sensitive.
Highlight Cells That Don’t Match
To compare two columns row by row and highlight the differences, select A1:A10, go to Home ➜ Conditional Formatting ➜ New Rule ➜ Use a formula to determine which cells to format, enter the formula below, pick a fill color and click OK:
=A1<>B1
Frequently Asked Questions
Is comparing cells in Excel case-sensitive?
Not with the equals operator, IF or COUNTIF: “Apple” and “apple” count as the same. Only EXACT checks the case.
How do I check if two cells are not equal?
Use the not equal to operator, like =A1<>B1. It returns TRUE when the values are different.
Can I compare a cell with part of another cell?
Yes. To check if B1 contains the text in A1, use SEARCH with ISNUMBER, which returns TRUE when the text is found anywhere in the cell:
=ISNUMBER(SEARCH(A1,B1))
The row-wise test answers a different question from a list comparison. If A contains North, South and B contains South, North, both row comparisons return FALSE even though neither list is missing a region. I use row equality when the rows are already aligned, and a lookup against the whole other column when order is free to change.