Logical operators are also known as the comparison operators in excel and they are used to compare two or more values, the return output given by these operators are either true or false, we get true value when the conditions match the criteria and false as a result when the conditions do not match the criteria.
List of Logical Excel Operators
Logical Excel Operator symbols are used to compare two or more values in Excel. When you compare one value against the other we get the result in Boolean type. Boolean values are TRUE or FALSE.
Below are the most commonly used logical operators in excel –
|Sr No.||Logical Operator Excel Symbol||Operator Name||Description|
|1||=||Equal to||Compares One Value to Other Value|
|2||>||Greater Than||Tests whether the value is greater than a certain value or not|
|3||<||Less Than||Tests whether the value is less than a certain value or not|
|4||>=||Greater Than or Equal To||Tests whether the value is greater than or equal to a certain value or not|
|5||<=||Less Than or Equal To||Tests whether the value is less than or equal to a certain value or not|
|6||<>||Not Equal To||Tests whether a particular value is not equal to a certain value or not|
Now we will look at each one them in detail.
#1 – Equal Sign (=) to Compare Two Values
We can use the equal sign (=) to compare one cell value against the other cell value. We can compare all types of values using an equal sign. Assume we have below values from cell A1 to B5.
Now I want to test whether the value in cell A1 is equal to cell B1 value.
Step 1: In order to select the value of A1 to B1 let us open the formula with an equal sign.
Step 2: Select cell A1 now.
Step 3: Now type the one more excel logical operator symbol equal sign (=).
Step 4: Now select the second cell we are comparing i.e. B2 cell.
Step 5: Ok we are done. Let hit enter key to close the formula. Copy and paste to other cells.
So we got TRUE as the result if the cell 1 value is equal to cell 2 or else we got FALSE as the result.
#2 – Greater Than (>) Sign to Compare Numerical Values
Unlike equal sign (=) greater than sign (>) can only test numerical values, not text values. For example, if your values in cell A1 to A5 and you want to test whether these values are greater than (>) the value of 40 or not.
Step 1: Open the formula in B2 cell and select the cell A2 as the cell reference.
Step 2: Since we are testing the value is greater than mention > symbol and apply the condition as 40.
Step 3: Close the formula and apply to remaining cells.
Only one value is >40 i.e. cell A3 value.
In the cell A6 value is 40, since we have applied the excel logical operator > as the criteria formula returned the result is FALSE. We will see how to solve this issue in the next example.
#3 – Greater Than or Equal To (>=) Sign to Compare Numerical Values
In the previous example, we have seen the formula returned TRUE value only to those values which are greater than the criteria value. But if the criteria value is also to be included in the formula then we need to use the >= symbol.
Previous formula excluded the value of 40 but this formula included.
#4 – Less than Sign (<) to Compare Numerical Values
Like how greater than tests the numerical values, similarly less than also tests the numbers. I have applied the formula as <40.
It works completely opposite to the greater than criteria. It has returned TRUE to all those values which are less than the value of 40.
#5 – Less Than or Equal To Sign (<=) to Compare Numerical Values
Like how >= sign included the criteria value also in the formula similarly, <= also performs the same way.
This formula included the criteria value in the formula, so the value of 40 is returned as TRUE.
#6 – Not Equal Sign (<>) to Compare Numerical Values
Combination of greater than (>) and less than (<) signs make the operator sign not equal to <>. This works completely the opposite to equal sign. The equal sign (=) tests whether the one value is equal to other value and returns TRUE, whereas not equal to sign <> returns TRUE if the one value is not equal to another value and returns FALSE if the one value is equal to another one.
As I told A3 & B3 cell values are same but formula returned FALSE which is completely different than the EQUAL sign logical operator in excel.
Logical Operator in Excel with Formulas
We can also use logical operator symbols in other excel formulas. IF Excel function is one of the often used formulae with logical operators in excel.
#1 – IF with Equal Sign
If the function tests the condition is equal to a certain value or not. If the value is equal then we can have own value. Below is a simple example of that.
The formula returns Same if the cell A2 value is equal to B2 value, if not it will return Different.
#2 – IF with Greater Than Sign
We can test certain numerical values and arrive results if the condition is TRUE and return a different result if the condition is FALSE.
#3 – IF with Less Than Sign
Below formula will show the logic of applying if with less than the excel logical operators.
Things to Remember About Logical Operators in Excel
- Excel logical operator symbols return only TRUE or FALSE as the result.
- Combination of > & < symbols make not equal sing <>.
- >= & <= sign includes the criteria also in the formula.
This has been a guide to Logical Operators in Excel. Here we discuss the top 6 types of MS Excel Logical Operators along with practical examples and downloadable excel template. You may learn more about excel from the following articles –