Excel’s logical operators are used in formulas to perform comparisons, and to build formula criteria . Logical operators can be used in formulas on their own, or combined with each other and/or other functions. The table below lists the logical operators available in Excel:
| Operator | Meaning | Example |
|---|---|---|
| = | Equal to | =A1=10 |
| <> | Not equal to | =A1<>10 |
| > | Greater than | =A1>100 |
| < | Less than | =A1<100 |
| >= | Greater than or equal to | =A1>=75 |
| <= | Less than or equal to | =A1<0 |
Note: all Excel formulas must begin with an equal sign (=). This is a syntax requirement, not a logical comparison.
Math operators are listed here . See this list of formulas for many examples of logical operators in formulas. Note that a text value is greater than any number in Excel.
A logical test (also called a “logical expression) is an expression that returns either TRUE or FALSE. For example, to test if A1 equals “apple”, you can use a formula like this:
=A1="apple" // returns TRUE or FALSE
To test if the value in A1 is between 5 and 10, you can use a formula like this:
=AND(A1>5,A1<10) // returns TRUE or FALSE
Logical tests in Excel formulas can be simple or quite complex, depending on the formula. Often, you will see several different logical tests in a single formula. In formulas that need to evaluate many cells at once, you will see logical tests that use Boolean logic .
Here are a few examples of formulas based on logical tests:
- If cell equals
- If cell is blank
- Cell contains specific text
- Cell contains one of many things