Excel Comparison Operators Explained: <>, >=, and <= in Formulas and Conditions
🔍 WiseChecker

Excel Comparison Operators Explained: <>, >=, and <= in Formulas and Conditions

You need to compare values in Excel to make decisions in your data. Comparison operators like <>, >=, and <= are the symbols that perform these logical tests. They are essential for functions like IF, COUNTIF, and conditional formatting. This article explains what each operator does and how to use them correctly in your formulas and rules.

Key Takeaways: Excel Comparison Operators

  • Greater than or equal to (>=): Returns TRUE if the first value is larger than or equal to the second value in a logical test.
  • Less than or equal to (<=): Returns TRUE if the first value is smaller than or equal to the second value in a logical test.
  • Not equal to (<>): Returns TRUE if two compared values are different from each other.

What Comparison Operators Do in Excel

Comparison operators are symbols that evaluate the relationship between two values. They form the core of any logical test in Excel. When you use an operator like >=, Excel compares the value on the left with the value on the right. The result is always a logical value: TRUE or FALSE. This TRUE/FALSE output is what powers functions that make decisions, such as IF, and tools that filter data, like advanced filters.

You can use these operators to compare numbers, text strings, dates, and even the results of other formulas. For example, the formula =A1>=100 checks if the number in cell A1 is 100 or more. The formula =B1<>“Completed” checks if the text in B1 is anything other than the word “Completed”. It is important to remember that text comparisons in Excel are case-insensitive. The operator <> will see “YES” and “yes” as the same text value.

Understanding the Six Core Operators

Excel uses six primary comparison operators. The equals sign (=) checks for equality. The greater than (>) and less than (<) symbols check if one value is larger or smaller. The three operators in this article's title add nuance to these basic checks. The >= operator combines greater than and equals into one test. Similarly, <= combines less than and equals. The <> operator is the opposite of the equals sign; it specifically looks for inequality.

How to Use Comparison Operators in Formulas

You place comparison operators between two values you want to test. These values can be cell references, numbers, text in quotes, or other functions. The structure is always =[Value1] [Operator] [Value2].

  1. Create a simple logical test
    Click on an empty cell and type an equals sign. Reference your first cell, type the operator, and then reference your second cell or type a constant value. For example, type =C2>=500 to test if the value in C2 is 500 or more. Press Enter to see the result, which will be either TRUE or FALSE.
  2. Use an operator inside the IF function
    The IF function uses a logical test to decide what to do next. Start by typing =IF(. For the logical_test argument, write your comparison. For example, type =IF(A1<>0, B1/A1, “N/A”). This formula checks if A1 is not zero. If TRUE, it divides B1 by A1. If FALSE, it shows “N/A”.
  3. Apply an operator in COUNTIF or SUMIF
    These functions need a criteria argument that often uses a comparison operator. In COUNTIF, the range is your data, and the criteria is your test. To count cells in range D1:D100 that are less than or equal to 10, use the formula =COUNTIF(D1:D100, “<=10"). Note that the operator and number must be inside quotation marks.
  4. Set up a conditional formatting rule
    Select the cells you want to format. Go to Home > Conditional Formatting > Highlight Cells Rules > Greater Than. In the dialog box, you can type a value like 100 or reference a cell. To use a different operator like <=, choose "Less Than or Equal To" from the same menu. You can also use New Rule and the "Use a formula to determine which cells to format" option for more complex comparisons.

Common Mistakes and Formula Errors

Getting a #VALUE! Error With Text Comparisons

This error often appears when you try to use a mathematical operator like >= or <= on text strings that cannot be logically ordered. While Excel can check if text is equal or not equal, asking if one word is "greater than or equal to" another word causes a #VALUE! error. Use <> or = for text comparisons unless you are specifically comparing alphabetical order.

Conditional Formatting or COUNTIF Not Working

If your rule or formula seems to ignore certain cells, check the data type. A number stored as text will not be correctly evaluated by operators like >=. The value “100” in quotes is text, while 100 without quotes is a number. Use the VALUE function or an error-checking tool to convert text to numbers. Also, ensure the criteria in COUNTIF is in the correct format, with the operator and value inside double quotes.

Incorrect Results With Dates

Dates in Excel are stored as serial numbers. A comparison like =A1>=”1/15/2024″ may work, but it is safer to use the DATE function to avoid system date format confusion. Write the test as =A1>=DATE(2024,1,15). This ensures Excel correctly interprets the date you intend to use in the comparison.

Comparison Operator Usage and Syntax

Item Basic Operators (=, >, <) Combined Operators (>=, <=, <>)
Primary Use Check for simple equality or directional difference Check for equality combined with a direction, or for any difference
Example Formula =A1>100 =A1>=100
Result for A1=100 FALSE TRUE
Use in COUNTIF Criteria =”>10″ =”>=10″
Handling Text Can compare alphabetical order <> works for text; >= and <= may cause #VALUE! error

You can now use comparison operators to build logical tests in your Excel worksheets. Try combining them with the AND and OR functions to create multi-condition checks for more complex analysis. For advanced filtering, use these operators directly in the criteria range of an Advanced Filter to isolate specific data segments.