Logical Operators in Excel: Less Than, Greater Than (+More!)
We all have read about logical operators in high school – even if we didn’t like them then.
Similar to those, Excel provides comparison operators that return the result in TRUE or FALSE.
These operators are like “less than or equal to” and “greater than or equal to” which are very helpful in quick data analysis.
In this guide, we will discuss all the aspects of logical operators and see how to use them. So stay tuned! 🤗
Also, if you want to practice along the guide, you can get our free sample workbook here.
Table of Contents
What are logical operators in Excel?
Logical operators are also known as comparison operators because their primary purpose is to compare two values.
These operators always only consider the value. And that’s regardless of how it is derived – even if it’s from a formula.
Also, a logical operator never returns numerical values in the result, only TRUE and FALSE. The value of TRUE and FALSE is 1 and 0, respectively – which are binary digits.
The comparison operators can also handle any Boolean expression. Hence, they are called Boolean operators.
In Excel, there are six Boolean operators you can use. These are:
- Less than
- Less than or equal to
- Greater than
- Greater than or equal to
- Equal to
- Not Equal to
Let’s study all these operators in depth below 🚀
Less than in Excel
As evident from the name, the ‘Less than’ operator checks if the first value is less than the second value or not. If it is, it returns TRUE; otherwise, it returns FALSE, and it is denoted by <.
Let’s understand its concept using an example.
We have the following data set.
We want to check if cell A2 is less than cell B2. For that:
- Select cell C2.
- Type in the formula
=A2<B2
- Press Enter.
Excel shows the result as follows:
To do the same for all other entries, simply double-click the Fill Handle as:
Pro Tip!
Excel can also compare text values, but by their alphabetical order. It compares the first letters of both values. And determines which of the two falls lower in the order.
However, if both the first values are the same, the operator moves on to the second one, and so forth 😀
Less than or equal to in Excel
The ‘Less than or equal to’ operator is the same as the ‘Less than’ operator. The only difference is that it returns TRUE if the first value is smaller or equal to the second value. It is represented by <=
Let’s see it working through a quick example.
We have identical values in the first two cells below.
If we apply the formula:
=A2<=B2
Excel would return the result TRUE.
Similarly, if we reduce the value of cell A2, it would still show TRUE as:
That’s because the condition is to return TRUE if the first value is less than or equal to the second value. Since the value, in this case, is lesser, Excel returns TRUE. Otherwise, it would return FALSE.
Less than or equal to’ example with the IF function
You can also combine logical operators with Excel functions.
Let’s see an example using the IF function with the ‘Less than or equal to’ operator below.
Suppose, we have the following data set.
We want to check if the first value in A2 is less than or equal to the value in cell B2 or not. If it is, the IF function will return ‘Right,’ and if it is not, it will return ‘Wrong.’
So, for this, we will enter the formula:
=IF (A1<=B1, “Right,” “Wrong”)
Hit Enter.
The IF function returns “Right” because the values in cells A2 and B2 are equal.
Double Click the Fill Handle to copy the formula to the remaining entries.
Excel returns “Right” for all the values that fulfill the condition, i.e., are less than or equal to the second value. And for the ones that don’t fulfill the condition, Excel returns “Wrong.”
Greater than in Excel
The ‘Greater than’ logical operator checks if the first value is greater than the second. It’s the opposite of the ‘Less than’ operator and is denoted by >.
Let’s see it using an example 👀
We have the following data.
We want to check if the value in cell A2 is greater than the value in cell B2. For that:
- Select C2.
- Enter the formula
=A2>B2
- Hit Enter.
The result TRUE shows that cell A2 is greater than cell B2.
Drag down the Fill Handle to copy the formula.
Pro Tip!
For text values, the ‘Greater than’ operator begins the count from the bottom of the English alphabet – Z.
‘Greater than’ example with the SUMIF Function
Let’s see how to use the ‘Greater than’ operator with the SUMIF function below.
We have the following sample data.
To use the SUMIF function, we will apply the formula:
=SUMIF(A2:A7, “>”&B2, B2:B7)
Note that we have used the “&” ampersand after the logical operator. This is because our target value was in another cell, so we used the cell reference and joined it with the condition.
Comment
Make sure to enclose the logical operators in double quotation marks as we did above. Otherwise, they are considered to be text strings.
Press Enter and Excel returns the result:
And tada! It’s done. That’s how easy it is to use the SUMIF function with the ‘Greater than’ operator 😉
Greater than or equal to in Excel
As the name suggests, the ‘Greater than or equal’ sign tells if a value is greater than or equal to its counterpart. If it is, the operator returns TRUE otherwise, it returns FALSE. The ‘Greater than or equal’ operator is denoted by ≥.
Let’s see how it works through an example below.
We have the following example data.
If we apply the ‘Greater than or equal to’ operator on cells A2 and B2 as:
=A2>=B2
Excel returns TRUE as both the values are equal to each other.
Similarly, if we increase the value of cell A2 by 1, the result will remain the same.
That’s because the condition given is to check if the value in the first cell is greater than the value in the second cell or equal to it.
Not equal to in Excel
The ‘Not equal to‘ operator is self-explanatory!
But the symbol is not🤔
It is denoted <>, and it returns FALSE if two values are equal to each other; otherwise, it returns TRUE. It is the opposite of the ‘Equal to’ operator.
Let’s see it in action through an example.
This is our sample data.
We will apply the ‘Not equal to’ operator to cells A2 and B2 as:
=A2<>B2
Excel returns FALSE as a result:
Here Excel returned FALSE because both the cell values were the same. And the ‘Not equal to’ operator returns FALSE for identical values.
To copy the same formula down the rows, double-click the Fill Handle.
Excel copied the formula to the remaining rows 😊
That’s it – Now what?
And tada! You now know everything about Excel logical operators 🥳
We learned so much about them in this article. We saw how the ‘Less than’ and ‘Greater than’ operators work. We also learned how to use them with text values and interpret the answer.
All this knowledge takes us one step closer to Excel mastery. But it doesn’t end here. This giant spreadsheet has tons of other things to offer.
If you want to polish your Excel skills, we recommend you master the VLOOKUP, IF, and SUMIF functions.
You learn those in my 30-minute free course delivered straight to your inbox. So enroll now and learn these fantastic functions!
Other resources
Boolean operators are very useful when you need quick results for extensive data. And even more useful when combined with Excel functions like COUNTIF function and SUMIF function, etc.
If you enjoyed reading this article, we bet you’d want to learn more. Some related topics include the IF, TRUE & FALSE, and Excel Logical Functions.