How to Compare Two Cells in Excel (Columns and Rows)

- Written by Puneet

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 the cells A1 and B1, respectively, and now, you need to compare both cells.

compare-two-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

compare-cells-using-equal-operator

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 simple steps for this…

  1. First, in cell C1, enter the equal operator to start the formula.
  2. After that, refer to cell A1, where we have the first values.
  3. Next, enter the equal operator to compare values from the cells.
  4. Now, refer to cell B1, where you have the second value.
  5. 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 “Yes,” the result will be TRUE.

compared-cells-result

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-Cell

There’s also a function in Excel that you can use, and that’s EXACT. With the EXACT function, match text values from two cells, and you can refer to the cells you want to compare. The result will return TRUE or FALSE.

We are using the same example:

  1. First, in cell C1, enter the EXACT function.
  2. After that, refer to cell A1.
  3. Next, enter a comma.
  4. Now, refer to cell B1.
  5. In the end, enter the closing parentheses and hit enter to get the result.
exact-function-to-compare

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.

  1. First, in cell C1, enter the IF function.
  2. After that, we will compare cells in the same way that we used in the first method.
  3. Next, in the function’s second argument, enter the value you want to get if both values match.
  4. Now, in the third argument of the function, enter the value you want to get if both values do not match.
  5. In the end, enter the closing parentheses and close the function.
using-if-comparing-cells

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")

Get the Excel File

Leave a Comment