The less than or equal to (<=) operator is used to compare two items in Excel. The operator typically returns a boolean value until you create a different calculation based on this condition. In Excel, you could use the less than or equal to an operator to return different values in multiple ways.
If you’re looking to use this operator in Excel, allow this article to be your guide. In this article, we have mentioned several ways you could use the less than or equal to the operator in Excel, so keep reading!
What Values Does the Less Than or Equal to Return?
Universally, the less than or equal to operator returns a boolean value. A boolean value is a data type that returns one of two values: True or False.
If you use a string data type (consisting of texts, numbers, and symbols) in your condition, the operator returns True or False depending on the value you enter.
For numeric data types, the operator returns a binary boolean value. If your condition is True, Excel returns the value 1. Likewise, if your condition is False, you will receive 0 as your returned value.
However, it is important to remember that this is only applicable in calculations. If you compare the values in terms of their value, the returned value is still True or False.
How Can You Use Less Than or Equal to on Excel
The less than or equal to operator is denoted by pairing the less than (<) and equals to (=) sign. In Excel, you could use the operator to compare and then calculate or format cells with Text, Number, and Date. Additionally, you could use the operator in built-in library Excel functions like IF, AVERAGEIF, LEN, and SUMIF.
You could use the operator to compare the length of two or more texts in different cells in your worksheet. If the length of the value in the cell you’ve entered first is less than or equal to the next cell value, the condition returns TRUE. Only when the length of the value referred in the first cell exceeds the second one, Excel displays FALSE.
Here are instances where the operator returns TRUE or 1:
- =“Apple”<= “House”
- =“Apple”<= “Cucumber”
In the first instance, the length of both values is five characters long, making them equal. This makes the condition true. Furthermore, in the second case, the length of characters in Apple is lesser than that of cucumber, making the condition true again.
Similarly, here is an example when the operator returns FALSE or 0:
As we’ve already discussed, the only time the operator returns False is when the first value’s character exceeds the latter’s length. In this case, the length of Apple is longer than that of Key. Hence, the operator returns FALSE.
The less than or equal to operator works with numeric data types in two ways. If you compare the values of two numbers, similar to texts, the operator will return either True or False.
Here are the instances where the less than or equals to command will return TRUE or 1:
The number 10 is less than 15 in the first example, so this condition is true. Similarly, in the second instance, the number 10 equals 10. If this condition were inserted in a calculation, the value would be represented as 1.
For the operator to return FALSE or 0, your condition must look something like this
To state the obvious, the number 10 is neither less than nor equal to 9. Therefore, the operator returns FALSE or 0 in the case of numeric calculations.
You could also use the less than or equals to sign (<=) while comparing dates. Dates are stored as numbers and formatted according to your system’s date format. So, any format you enter your date in shouldn’t be a problem while comparing the values.
Remember, the earlier the date is, the smaller its value is in Excel. The less than or equal to the operator will return a TRUE or FALSE boolean value depending on the condition you’ve given.
You will get TRUE using conditions like the following:
In the first instance, the value of 11th August 2002 is lesser than the value of 18th September 2022. Similarly, the values of the dates mentioned in the second instance is the same. Therefore, both instances return the TRUE boolean value.
To get a FALSE or 0 value, the conditions must look like this:
- =18-Sep-22 3:00PM <= 18-Sep-22
The first instance may seem fairly obvious; 11th August 2002 comes before 18th September 2022. However, the second example may raise a few eyebrows. When you enter a date without mentioning the time, Excel records the time as 12:00AM. As 12 AM comes before 3 PM, this condition is False.
You can add the less than or equal to operator on conditional functions such as IF, AVERAGEIF, and SUMIF. Using such conditional functions, you can customize your returned value depending on if the condition is TRUE or FALSE.
You can use the IF function to enter two outcomes depending on the nature of your condition.
Firstly, you will have to specify criteria which, if the condition meets, will be considered as TRUE and FALSE if it fails to do so. Then, separated by the comma sign (,), you will have to enter your boolean values; true followed by false.
Follow this format to enter the formula with the IF function:
=IF(criteria, “result if true”, “result if false”)
Let’s say we’re calculating the sales of each month in a year. The break-even number is $20,000. We could use the IF function to determine if the company had a profit or loss that month using this formula:
=IF(cell<= 20000, Loss, Profit)
Excel has its own function to calculate the average of a data set. However, what if you need to calculate the average only if it is under a certain number? In that case, you can use the less than or equal to operator with the AVERAGEIF function.
Here is the format you can refer to enter the formula with the AVERAGEIF function:
=AVERAGEIF(range, criteria, [average range])
You could use the less than or equal to operator with the SUMIF function to set criteria for the referred cells to follow to sum the data up.
Refer to the following format to enter the SUMIF function in a formula:
=SUMIF(range, criteria, [sum range])
You could also use the less than or equal to operator while applying Conditional Formatting on your selected cells. For example, if you want to highlight all cells below a certain number, you could apply the less than or equal to operator to format those cells.
Here are the steps you could refer to use the less than or equal to sign to conditionally format your cells:
- Open your Excel workbook.
- Select the cells with the value.
- From the home tab, select Conditional Formatting in the Styles section.
- Head to New Rule.
- Under Select a Rule Type, select Use a formula to determine which cells to format.
- Enter your formula under Format values where this formula is true in this format:
=cell <= (criteria)
- Select Format from the bottom-right corner of your screen.
- Head to the Fill tab.
- Select a color and click OK.
- Click on OK again.
Excel will format your cells according to your criterion.