# Compare Two Cells in Excel and Return TRUE or FALSE (5 Quick Ways)

Get FREE Advanced Excel Exercises with Solutions!

While working in Microsoft Excel, often we need to compare two cells in excel. This is a basic operation we do in excel and luckily, excel has several options to compare cells. However, this article will guide you on how to compare two cells in excel and return TRUE or FALSE.

## 5 Quick Ways to Compare Two Cells in Excel and Return TRUE or FALSE

Let’s consider a dataset (B5:D10) containing fruit names in two columns (columns B & C). Now, I will compare fruit names between two cells of these columns and thus return TRUE/FALSE accordingly. ### 1. Use ‘Equal to’ Sign to Compare Two Cells and Return TRUE or FALSE

We can compare two cells simply using an equal to (=) sign. This is the easiest and most basic way to compare two cells in excel.

Steps:

• First, type the below formula in Cell D5 and press Enter from the keyboard.
`=B5=C5` • As a result, you will get the below result because both Cell B5 and C5 contain the same fruit: Watermelon. Now, use the Fill Handle (+) tool to copy the formula to compare the rest of the cells. • Finally, you will see the below result. The above formula has returned TRUE/FALSE for each pair of cells depending on their cell contents. Read More: How to Compare Text in Excel and Highlight Differences (8 Quick Ways)

### 2. Compare Two Cells and Return TRUE or FALSE with Excel EXACT Function

This time, I will use the EXACT function in excel to compare two cells. Usually, the EXACT function checks whether two text strings are exactly the same, and returns TRUE or FALSE  But, remember, the EXACT function is case-sensitive.

Steps:

• Type the below formula in Cell D5 and hit Enter.
`=EXACT(B5,C5)` • Consequently, we will get the below result. I have used the Fill Handle tool to copy the above formula over the range D6:D11. Read More: Return YES If 2 Cells Match in Excel (10 Methods)

### 3. Excel COUNTIF Function to Compare Two Cells and Get TRUE/FALSE

You can use the COUNTIF function to compare two cells in excel and thus return TRUE or FALSE.

Steps:

• Type the below formula in Cell D5 and press Enter.
`=COUNTIF(B5:C5,B5)=2` • As a consequence, we will receive the below output. Similar to previous methods, use the Fill Handle tool to copy the above formula to compare the rest of the cells. Here, the COUNTIF function counts the number of cells within the range B5:C10, for the given condition B5:C10=B5. And, 2 refers to the number of cells you want to check for. For instance, if I have to compare three cells I will type the formula as =COUNTIF(B5:D5,B5)=3.

### 4. Use IF Function to Compare Two Cells and Return TRUE or FALSE in Excel

We can compare two cells easily by using the IF function in excel. We can provide TRUE and FALSE as the arguments in the IF function. So, let’s follow the below steps to do the task.

Steps:

• Type the below formula in Cell D5 and hit Enter.
`=IF(B5=C5,"TRUE","FALSE")` • Upon entering the formula, here is the result we receive. Use the Fill Handle tool to copy the formula to the rest of the cells. Here, the IF function checks whether one cell value is equal to another (e.g. B5=C5), and returns TRUE if the above condition is met. On the other hand, the function returns FALSE if cell values are not equal.

### 5. Combine VLOOKUP and ISERROR Functions to Compare Two Cells and Get FALSE in Return

Now, I will use the VLOOKUP function to compare two cells in excel. However, If we compare two cells merely using the VLOOKUP function, the #N/A error occurs if values are not similar in cells. So, to avoid the error, I will use the IFERROR function along with the VLOOKUP function.

Steps:

• Type the below formula in Cell D5 and press Enter.
`=IFERROR(VLOOKUP(C5,\$B\$5:\$B\$10,1,0),"FALSE")` • Consequently, we will get the below output. I have used the Fill Handle tool to compare other cells in the dataset. 🔎 How Does the Formula Work?

• (VLOOKUP(C5,\$B\$5:\$B\$10,1,0)

Here, the VLOOKUP function looks for the value of Cell B5 in the range B5:B10 returns:

{#N/A}

• IFERROR(VLOOKUP(C5,\$B\$5:\$B\$10,1,0),”FALSE”)

Later, to avoid the error, we have wrapped the VLOOKUP formula with the IFERROR function, and the formula returns:

{FALSE}

## Conclusion

In the above article, I have tried to discuss several methods to compare two cells in excel and return TRUE/FALSE. Hopefully, these methods and explanations will be enough to solve your problems. Please let me know if you have any queries.

## Related Articles Hosne Ara

Hi, This is Hosne Ara. Currently, I do write for ExcelDemy. I have a long experience working with different industries and I have seen how vast the scope of Microsoft Excel is. So, eventually, I started to write articles on Excel and VBA. Basically, my articles are targeted to help people who are working in Excel. By profession, I am an Engineer. Materials and Metallurgical Engineering is my major. Besides, I am a certified Project Manager (PMP) too. I have worked with Power Plant and IT industry earlier. As a person, I am detail-oriented and love doing research. Establishing a greener world is one of my mottos.

We will be happy to hear your thoughts Advanced Excel Exercises with Solutions PDF  