MS Excel features a variety of operators to perform calculations on any set of data. Logical operators, also known as Boolean operators, are used to compare two values and return the output as either True or False.

If you need to check if a value in cell “X” is equal to the value in cell “Y,” you can simply use the “Equal to” operator. There exists a total of six such logical operators in Excel.

In addition to it, you can also couple logical operators with one or more conditional functions to perform logical operations when certain conditions are met.

## “Equal to” Operator

The “Equal to” operator is used to compare values between two cells. It can be used to compare both numerical and alphabetical data.

**Syntax:** =Value1=Value2

Formula Example | Result |

=A1=B1 | Returns TRUE if values in cells A1 and B1 are the same and FALSE otherwise. |

=A1=“Apples” | Returns TRUE if cell A1 contains the word “Apples,” FALSE otherwise. |

=A1=(B1/2) | Returns TRUE if a number in cell A1 is equal to the division of B1/2, FALSE otherwise. |

**Example: **

Let us take column A with some numerical values. Now imagine we need to figure out how many of those values are equal to “10.” To perform this check, we can use the “Equal to” operator.

- Chose an empty cell beside cell A2.
- Type in
`=A2=10`

(A2 is the cell number for this case.) - Hit Enter to see your result.

## “Not Equal to” Operator

Excel’s “Not Equal to” operator is used in situations where you want to verify that a cell’s value is not equal to a specified value. It works opposite to the Equal to operator.

**Syntax**: =Value1<>Value2

Formula Example | Result |

=A1<>B1 | Returns true if A1 contains any value other than the date 7/30/2023 and FALSE otherwise. |

=A1<>”Apples” | Returns TRUE if cell A1 contains any value other than “Apples,” and FALSE if vice-versa. |

=A1<>(B1/2) | Returns TRUE if a number in cell A1 is not equal to the division of B1/2 and FALSE otherwise. |

=A1<>(DATEVALUE(“7/30/2023”) | Returns true if A1 contains any value other than the date 7/30/2023 and FALSE otherwise. |

**Example: **

Let us take column A with a list of items. Suppose we have to find out how many of those items are not “Steelseries.” We can use the “**Not Equal to**” sign to verify it.

- Select the empty cell beside A2.
- Type in
`=A2<>"Steelseries"`

. - Hit Enter to view your results.

## Greater Than Operator

**Syntax**: =Value1>"X"

It returns TRUE if Value1 is greater than “X”, and FALSE otherwise.

**Example: **

If you want to check if the values in a cell are greater than 90, then you can use the syntax above to check whether the value is greater than 90 or not.

## Greater Than or Equal to Operator

`Syntax: =Value1>="X"`

It returns TRUE if Value1 is greater than or equal to “X”, and FALSE otherwise.

**Example: **

Using the syntax above, you can check whether a value in a cell is greater than or equal to 90 returns TRUE or not.

## Less than Operator

**Syntax**: =Value1<Value2

It returns TRUE if Value1 is less than Value2, and FALSE otherwise.

**Example: **

To compare whether the value in cell A1 is less than that of B1, you can use the syntax mentioned above.

## Less Than or Equal to Operator

**Syntax**: =Value1<="X"

It returns TRUE if Value1 is less than or equal to “X”, and FALSE otherwise.

**Example: **

To compare whether the value in a certain cell is less than or equal to that of another cell, you can use the syntax mentioned above.

## Using Conditional Function with Logical Operator

The logical operators can also be integrated with the IF function in Excel. If you need to determine the Pass or Fail result from a set of values, then you could use logical operators with the `IF`

function.

The `IF`

function allows Excel to return a specified result based on a logical comparison between two values.

**Syntax:** =IF(Logical Condition, Output if True, Output if False)

### IF with Equal to Sign

Suppose you want the output to return “YES” if cell A2’s value is equal to that of cell B2, you can use the IF function with the equal to sign.

- Open the data in Excel Sheet.
- Select a cell and type
`=IF(Value1=Value2, “YES”,”NO”)`

- Hit Enter, and your result will appear.

### IF with Greater than Sign

Suppose you have the data of exam results of 10 students. If you want to check a value in cell B2 to return “Pass” if it is greater than 40 and “Fail” otherwise, you can use the if function with greater than operator.

`=IF (B2>40, “PASS”, “FAIL”)`

The formula for using **Less Than** is also similar. You need to replace the “>” sign with “<.”

### IF With Less Than or Equal to Sign

Suppose you have the data of exam results from 10 students. We will write a simple Excel formula that checks a value in cell B2 and returns “Pass” if it is greater than 40 and “Fail” otherwise.

`=IF (B2<=40, “FAIL”, “PASS”)`

## Using Nested IF with logical operators

Nested IF can be used with logical operators in multiple ways. However, for this example, we will be classifying the scores of a group of students on the basis of their exam results.

Let us put the names of the students in column A and their scores in column B. Now let’s classify the score on the basis of the following:

**Excellent:**Over 85**Good:**Between 75 and 84, inclusive**Satisfactory:**Between 65 and 74, inclusive**Poor:**Under 65

`=IF(B2>85, "Excellent", IF(B2>=75, "Good", IF(B2>65, "Satisfactory", "Poor")))`

Here’s what the final output will look like.

For further reading, you can also check out our other article on using the IF function with logical functions.