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

Let’s consider a dataset (B5:D10) containing fruit names in two columns (columns B and C). We will compare fruit names between these columns and return TRUE or FALSE accordingly.

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

Method 1 – Use the ‘Equal to’ Sign to Compare Two Cells and Return TRUE or FALSE

Steps:

  • Use the below formula in Cell D5 and press Enter.
=B5=C5

Use ‘Equal to’ Sign to Compare Two Cells and Return TRUE or FALSE

  • Use the Fill Handle (+) tool to copy the formula to compare the rest of the cells.

Use ‘Equal to’ Sign to Compare Two Cells and Return TRUE or FALSE

  • Here’s the result.


Method 2 – Compare Two Cells and Return TRUE or FALSE with the EXACT Function

Steps:

  • Use the below formula in Cell D5 and hit Enter.
=EXACT(B5,C5)

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

  • Use the Fill Handle tool to copy the formula over the range D6:D11.


Method 3 – The Excel COUNTIF Function to Compare Two Cells and Get TRUE/FALSE

Steps:

  • Use the following formula in Cell D5 and press Enter.
=COUNTIF(B5:C5,B5)=2

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

  • Use the Fill Handle tool to copy the formula and compare the rest of the cells.

The COUNTIF function counts the number of cells within the range B5:C5, for the given condition B5:C10=B5. If there are exactly two cells that share a value of B5 (including B5), the formula returns TRUE. Since the range is composed of two cells (the cell in column B and its corresponding value in column C), that will only happen if the values are equal.


Method 4 – Use the IF Function to Compare Two Cells and Return TRUE or FALSE in Excel

Steps:

  • Use the below formula in Cell D5 and hit Enter.
=IF(B5=C5,"TRUE","FALSE")

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

  • Use the Fill Handle tool to copy the formula to the rest of the cells.


Method 5 – Combine VLOOKUP and ISERROR Functions to Compare Two Cells and Ignore Errors

Steps:

  • Use the below formula in Cell D5 and press Enter.
=IFERROR(VLOOKUP(C5,$B$5:$B$10,1,0),"FALSE")

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

  • Use the Fill Handle tool to compare other cells in the dataset.

How Does the Formula Work?

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

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

To avoid the error, we wrapped the VLOOKUP formula with the IFERROR function, and the formula returns:

{FALSE}


Download the Practice Workbook


<< Go Back To Excel Compare Cells | Compare in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Hosne Ara
Hosne Ara

Hosne Ara is a materials and metallurgical engineer who loves exploring Excel and VBA programming. To her, programming is like a time-saving superhero for dealing with data, files, and the internet. She's skilled in Rhino3D, Maxsurf C++, MS Office, AutoCAD, and Excel & VBA, going beyond the basics. With a B. Sc. in Materials and Metallurgical Engineering from Bangladesh University of Engineering and Technology, she's shifted gears and now works as a content developer. In this role, she... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo