Logical Operators in Excel
Last Updated :
-
Blog Author :
Edited by :
Reviewed by :
Table Of Contents
List of Logical Excel Operators
Logical operators in Excel are also known as comparison operators. They are used to compare two or more values. The return output given by these operators is either TRUE or FALSE. We get a TRUE value when the conditions match the criteria and FALSE as a result when the conditions do not match the criteria.
Below are the most commonly used logical operators in Excel.
Now we will look at each one of them in detail.
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 |
Table of contents
- List of Logical Excel Operators
- #1 Equal Sign (=) to Compare Two Values
- #2 Greater Than (>) Sign to Compare Numerical Values
- #3 Greater Than or Equal To (>=) Sign to Compare Numerical Values
- #4 Less than Sign (<) to Compare Numerical Values
- #5 Less Than or Equal To Sign (<=) to Compare Numerical Values
- #6 Not Equal Sign (<>) to Compare Numerical Values
- Logical Operator in Excel with Formulas
- Things to Remember
- Recommended Articles
#1 Equal Sign (=) to Compare Two Values
We can use the equal sign (=) to compare one cell value against the other cell value. In addition, we can compare all types of values using an equal sign. For example, assume we have the below values from cells A1 to B5.
Now, we want to test whether the value in cell A1 is equal to cell B1's value.
- To select the value of A1 to B1, let us open the formula with an equal sign.
- Now, select cell A1.
- Now, type the one more logical operator symbol equal sign (=).
- Now, select the second cell we are comparing, the B2 cell.
- Press the "Enter" key to close the formula. Then, we must copy and paste it into other cells.
So, we get "TRUE'' as a result if the cell 1 value is equal to cell 2 or we get "FALSE."
#2 Greater Than (>) Sign to Compare Numerical Values
Unlike equal sign (=) greater than sign (>) can only test numerical values, not text values. So, for example, if the values are in cells A1 to A5 and we want to try whether these values are greater than (>) the value of 40 or not.
- Step 1: We must first open the formula in the B2 cell and select cell A2 as the cell reference.
- Step 2: Since we are testing, the value is greater than the mention > symbol and apply the condition as 40.
- Step 3: Now, close the formula and use it to remain cells.
Only one value is >40, i.e., cell A3 value.
Cell A6 value is 40; since we have applied the 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, the formula returns a TRUE value only to those greater than the criteria value. But if the criteria value is also included in the formula, we need to use the >= symbol.
The 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 are, similarly less than also tests the numbers. We have applied the formula as <40.
It works opposite to the greater than criteria. It has returned TRUE to all those values that are less than 40.
#5 Less Than or Equal To Sign (<=) to Compare Numerical Values
Like how >= sign includes the criteria value in the formula similarly, <= also performs the same way.
This formula had the criteria value, 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 <>. It works opposite to an equal sign. The equal sign (=) tests whether the one value is equal to the 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 not equal to another one.
As we said, A3 and B3 cell values are the same, but the formula returns FALSE, which is completely different from the EQUAL sign logical operator.
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.
#1 - IF with Equal Sign
Suppose the function tests whether the condition is equal to a certain value or not. If the value is equal, then we can have our value. Below is a simple example of that.
The formula returns the Same if the cell A2 value is equal to the B2 value; if not, it will return Different.
#2 - IF with Greater Than Sign
We can test certain numerical values, arrive at results if the condition is TRUE, and return a different result if the condition is FALSE.
#3 - IF with Less Than Sign
The below formula will show the logic of applying if with less than the logical operators.
Things to Remember
- Excel logical operator symbols return only TRUE or FALSE.
- Combination of > & < symbols do not equal sign <>.
- >= & <= sign includes the criteria also in the formula.
Recommended Articles
This article is a guide to Logical Operators in Excel. We discuss the top 6 types of MS Excel logical operators, practical examples, and a downloadable Excel template. You may learn more about Excel from the following articles: -