How to compare 2 cells in Excel

Comparing two cells in Excel typically means evaluating the values in the two cells to determine if they are the same or different. This can be useful for a variety of tasks, such as checking for errors or inconsistencies in data, or verifying that two sets of information match. Note that you can also use other comparison operators such as “<“, “>”, “<=”, “>=”, “<>” (not equal to).

The first dataset contains information on passwords and the number of attempts made by users to enter the correct password. We need to compare the user’s entered password with the correct password, and we can do this using three methods: using formulas, using the Exact function, or using the IF function. The second dataset contains information on obtained marks, total marks, and passing marks. We need to determine whether the obtained marks are less than or greater than the passing marks, and we can do this using the IF function.

Method 1: Equal to Comparison using Formulae

Step 1 – Select the Cell

  • Click on the cell where you want to show the result

Step 2 – Type the Formula 

  • Type Equal to sign (=) in the selected cell
  • Then type the following formula:
  • =A2=$C$2

Step 3 – Press the Enter key

  • After typing the formula, press the Enter key to get the required result

Step 4 – Apply the Formula to complete the column

  • After pressing the Enter key, drag the cell to the last cell of the column to apply on the complete column

Method 2: Equal to Comparison using IF Function

The IF function in Excel is a logical function that allows you to test a condition and perform different actions depending on whether the condition is true or false.

  • The basic syntax of the IF function is:

=IF(condition, value_if_true, value_if_false)

where:

  • “condition” is the logical test that you want to perform
  • “value_if_true” is the value that Excel will return if the condition is true
  • “value_if_false” is the value that Excel will return if the condition is false

Step 1 – Select the Cell

  • Click on the cell where you want oi to show the result

Step 2 – Use the IF function

  • After selecting the cell, type “=IF(” to use the IF function

Step 3 – Type the Arguments

  • After typing the opening bracket, type the following Arguments:
  • Logical test: A2=$C$2
  • Value if true: True
  • Value if false: False
  • After typing the last argument, type a closing bracket “)

Step 4 – Press the Enter key

  • After typing the formula, press the Enter key to get the required result

Step 5 –  Apply the Function to complete the column

  • After pressing the Enter key, drag the cell to the last cell of the column to apply on the complete column

Method 3: Equal to Comparison using EXACT Function

The EXACT function in Excel is a logical function that compares two strings to determine if they are the same, character for character and most importantly it checks the case of both strings as well. The function returns the value “TRUE” if the strings match exactly including the letter case, and “FALSE” if they do not.

  • The syntax of the EXACT function is:

=EXACT(text1, text2)

where:

  • “text1” is the first text string you want to compare
  • “text2” is the second text string you want to compare

Step 1 – Select the Cell

  • Click on the cell where you want oi to show the result

Step 2 – Use the Exact function

  • After selecting the cell, type “=Exact(” to use the IF function

Step 3 – Type the Arguments

  • After typing the opening bracket, type the following Arguments:
  • Text 1: A2
  • Text 2: $C$2
  • After typing the last argument, type a closing bracket “)

Step 4 – Press the Enter key

  • After typing the formula, press the Enter key to get the required result

Step 5 –  Apply the Formula to complete the column

  • After pressing the Enter key, drag the cell to the last cell of the column to apply on the complete column

Method 4: Less Than / Greater Than Comparison using the IF Function

The IF function in Excel is a logical function that allows you to test a condition and perform different actions depending on whether the condition is true or false.

  • The basic syntax of the IF function is:

=IF(condition, value_if_true, value_if_false)

where:

  • “condition” is the logical test that you want to perform
  • “value_if_true” is the value that Excel will return if the condition is true
  • “value_if_false” is the value that Excel will return if the condition is false

Step 1 – Select the Cell

  • Click on the cell where you want oi to show the result

Step 2 – Use the IF function

  • After selecting the cell, type “=IF(” to use the IF function

Step 3 – Type the Arguments

  • After typing the opening bracket, type the following Arguments:
  • Logical test: A2<=$D$2
  • Value if true: False 
  • Value if false: True
  • After typing the last argument, type a closing bracket “)

Step 4 – Press the Enter key

  • After typing the formula, press the Enter key to get the required result

Step 5 –  Apply the Function to complete the column

  • After pressing the Enter key, drag the cell to the last cell of the column to apply on the complete column