How to Use Less Than or Equal to Operator in Excel

Microsoft Excel Logo

You can use the ‘less than or equal to (<=)’ operator with text, date, and number as well as with Excel functions to compare values in Excel.

‘Less Than or Equal to’ operator (<=) is one of the six logical operators (also known as the comparison operators) used in Microsoft Excel to compare values. The “<=” operator checks if the first value is less than or equal to the second value and returns ‘TRUE’ if the answer is yes or else ‘FALSE’. This is a boolean expression, so it can only return either TRUE or FALSE.

The ‘less than or equal to’ is used to perform the various logical operations in Excel. It is rarely used alone, and it is often combined with other Excel functions such as IF, OR, NOT, SUMIF, and COUNTIF, etc. to perform powerful calculations. In this tutorial, we will see how to use the ‘less than or equal to (<=)’ operator with text, date, and number as well as with Excel functions.

Compare Text Values with ‘<=’ Operator in Excel

The ‘less than or equal to’ operator can be used to compare text values in Excel. Before you compare values text values in Excel, you should know that all logical operators are case-insensitive. It means they ignore case differences when comparing text values.

There’s another thing, you should know when comparing text strings with logical operators in Excel. MS Excel considers the first alphabet “a” as the smallest value and the last alphabet “z” as the largest value. That means a < d, r < v, k > j, etc. Let us explain with an example.

Example 1: If you want to check the text value in cell A3 is less than or equal to the value in cell B4, use this simple formula:

=A3<=B3

An excel formula must always start with an equal sign ‘=’. The first argument is cell A3, the second argument is cell B3, and the operator is placed in between. Since both values are the same, the result is ‘TRUE’.

Instead of using cell references, you can also use direct text value as arguments in the formula. But when a text value is inserted in a formula, it must always be enclosed in double quotation marks like this:

="Ant"<="ant"

Since logical operators are case-insensitive, it ignores the case differences and returns TRUE as the result.

Example 2:

In the below example, “Ant” text is definitely not equal to “Elephant”. So you may be wondering, but how Ant is less than Elephant? Is it because it’s small? No, the first letter of cell A3 (“A”) is smaller than the first letter of cell B3 (“E”).

As we mentioned before, Excel considers that letters later in the alphabet are larger than earlier letters. Here, the formula compares the first letter of the A3 with the first letter of B3. The first letter ‘A’ < first letter ‘E’, so the formula returns ‘TRUE’.

Example 3:

When comparing texts, Excel starts with the first letter of the texts. If they are identical, it goes to the second letter. In this example, the first letter of A3 and B3 are the same, so the formula moves to the second letter of A3 and B3. Now, “p” is not less than “n”, hence, it returns ‘FALSE’.

Compare Numbers with ‘<=’ Operator in Excel

Using ‘less than or equal to’ with numbers is simple enough anyone can do it. You can also use this operator to build complex mathematical operations in Excel.

Here’s an example to compare to numbers with ‘<=’:

You can use the ‘less than or equal’ operator with mathematical operators as well as other logical operators to create complex mathematical operations.

For example, try this formula:

=(A4>B3)+(A1*B5)+(B2/2)+(B6<=A3)

In mathematical calculations, the result of logical operation ‘TRUE’ is the equivalent of 1, and FALSE is 0.

That means, first part of the formula (A4>B3) returns ‘0’ and the last part of the formula (B6<=A3) returns ‘1’. And our formula would look like this:

=0+(A1*B5)+(B2/2)+1

And the returning result would be ‘203’.

Compare Dates with ‘<=’ Operator in Excel

Besides text and numbers, you can also use the ‘less than or equal to’ operator to compare date values. Logical operators can also be used to compare between data types, like date and text or number and text, etc.

One thing you should know when comparing dates is that Excel saves dates and time as numbers, but they are formatted to look like dates. Excel date number starts from 1st of January 1900 12:00 AM, which is saved as 1, 2nd of January 1900 is saved as 2, and so on.

For instance, here a list of dates entered in Excel.

To see the numbers behind dates, press the shortcut keys Ctrl + ~ on the keyboard or change the format of the date to number or general. And you will see numbers of the above dates entered in excel as shown below.

Excel uses these numbers whenever a date is involved in a calculation.

Let’s take a look at this table:

  • C2: A2 date is less than the B2, hence, TRUE.
  • C3: A3 (which number is 42139) is greater than B3 – FALSE.
  • C4: A4 is less than B4 – TRUE.
  • C5: A5 (36666.263) is greater than B5 (36666). When only a date is entered, its default time is 12:00 AM, which is midnight. So the answer is FALSE
  • C6: A6 is greater than B6. Because a text is always considered as the largest value when compared to any number or date in Excel. Hence, it’s FALSE.

Sometimes, when you comparing a date value with a cell, Excel may consider the date value as a text string or arithmetic calculation.

In the below example, even though A1 is greater than “4-12-2020”, the result is “TRUE”. Because Excel considers the value as a text string.

Also, here the date part (5-12-2020) in the formula is considered as a mathematical calculation:

To fix this, you need to enclose a date in the DATEVALUE function, like this:

=A1<=DATEVALUE("5-12-2020")

Now, you would get the correct result:

Using ‘Less Than or Equal To’ Operator with Functions

In excel, logical operators (like <=) are widely used in parameters of Excel functions such as IF, SUMIF, COUNTIF, and many other functions to perform powerful calculations.

Using ‘<=’ with IF Function in Excel

The ‘<=’ operator can be used within the ‘logic_test’ argument of the IF function to perform logical operations.

The Excel IF function evaluates a logical condition (which is made by ‘less than or equal to’ operator) and returns one value if the condition is TRUE, or another value if the condition is FALSE.

The syntax for the IF function is:

=IF(logical_test,[value_if_true],[value_if_false])

Let’s assume, you have a list of student mark lists, and you want to check whether each student is passed or failed based on their test score. To do that, try this formula:

=IF(B2<=50,"Fail","Pass")

The passing mark is ’50’ which is used in the logical_test argument. The formula checks, if the value in B2 is less than or equal to ’50’, and returns ‘Fail’ if the condition is TRUE or returns ‘Pass’ if the condition is FALSE.

And the same formula is applied to the rest of cells.

Here’s another example:

For example, let’s say we have a clothes order list with prices. If the price of a dress is less than or equal to $150, we need to add a $20 delivery charge to the net price or add a $10 delivery charge to the price. Try this formula for that:

=IF(B2<=150, B2+$D$2, B2+$D$3)

Here, if the value in B2 is less than or equal to 150, the value in D2 is added to B2, and the result is displayed in C2. If the condition is FALSE, then D3 is added to B2. We added the ‘$’ sign before the column letters and row numbers of cell D2 and D3 ($D$2, $D$3) to make them absolute cells, so it doesn’t change when copying the formula to the rest of the cells (C3:C8).

Using ‘<=’ with SUMIF Function in Excel

Another Excel function that logical operators are more commonly used with is the SUMIF function. The SUMIF function is used to sum a range of cells when corresponding cells match a certain condition.

The general structure of SUMIF function is:

=SUMIF(range,criteria,[sum_range])

For example, let’s say you want to sum all the sales that happened on or before (<=) January 01, 2019, in the below table, you can use the ‘<=’ operator with SUMIF function to sum all values:

=SUMIF(A2:A16,"<=01-Jan-2020",C2:C16)

The formula check looks for all sales that occurred on or before (<=) 01-Jan-2020 in the cell range A2:A16 and sums all the sales amounts corresponding to those matching dates in the range C2:C16.

Using ‘<=’ with COUNTIF Function in Excel

Now, let’s use the logical operator ‘less than or equal to’ with the COUONTIF function. Excel COUNTIF function is used to counts the cells that meet a certain condition in a range. You can use the ‘<=’ operator to count the number of cells with a value that is less than or equal to the specified value.

The Syntax of COUNTIF:

=COUNTIF(range,criteria)

You have to write a condition using the ‘<=’ operator in the criteria argument of the function and the range of cells where you count the cells in the range argument.

Suppose you want to count the sales that are less than or equal to 1000 in the below example, then you can use this formula:

=COUNTIF(C2:C16,"<=1000")

The above formula counts cells that are less than or equal to 1000 in the range C2 to C16 and displays the result in cell F4.

You can also count cells by comparing a criterion value in a cell against a range of cells. In such cases, write criteria by joining the operator (<=) and a reference to the cell containing the value. To do that, you need to enclose the comparison operator in double quotes (“”), and then place an ampersand (&) sign between the logical operator (<=) and the cell reference.

=COUNTIF(C2:C16,"<="&F3)

Besides IF, SUMIF, and COUNTIF functions, you also use the ‘less than or equal’ operator with other less used functions such as AND, OR, NOR, or XOR, etc.

Using ‘<=’ Operator in Excel Conditional Formatting

Another common use for the ‘less than or equal to’ operator is in Excel Conditional Formatting which helps you highlight or differentiate data stored in your worksheet based on a condition.

For example, if you want to highlight the sales amounts that are less than or equal to ‘2000’ in column C, you have to write a simple rule using the ‘<=’ operator in Excel Conditional Formatting. Here’s how you do that:

First, select the cell range of cells where you want to apply a rule (condition) and highlight data (In our case C2:C16).

Then go to the ‘Home’ tab, click ‘Conditional Formatting’ and select ‘New Rule’ from the drop-down. 

In the New Formatting Rule dialog box, select the ‘Use a formula to determine which cells to format’ option under the Select a Rule Type section. Then, type the below formula to highlight sales that are less than or equal to 2000 in the ‘Format values where this formula is true’ box:

=C2<=2000

After you enter the rule, click the ‘Format’ button to specify the formatting.

In the Format Cells dialog box, you can choose the specific formatting you want to apply to highlight cells. You can change the number format, font format, borders style, and fill the color of the cells. Once, you have chosen the format, click ‘OK’.

Back in the New Formatting Rule dialog, you can see the preview of your selected format. Now, click ‘OK’ again to apply the formatting and highlight the cells.

As you can see, the sales that are less than or equal to 2000 are highlighted in column C.

As you have learned, the ‘<=’ operator is quite easy and useful in Excel to perform calculations.

That’s it.