Excel functions / Logical
Comparison operators
Compare two values with =, <>, >, <, >= and <=, returning TRUE or FALSE.
At a glance
= | Equal to. |
|---|---|
<> | Not equal to. |
> | Greater than. |
< | Less than. |
>= | Greater than or equal to. |
<= | Less than or equal to. |
How it works
Comparison operators ask a yes-or-no question about two values. =B2>=50 returns TRUE or FALSE on its own, and the same comparison is the test inside IF, COUNTIF and every other conditional function.
Text comparisons ignore case, so "yes" equals "Yes". Inside COUNTIF and SUMIF, the operator goes in quotes with the value: =COUNTIF(B2:B4,">=50").
Example
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Student | Score | Attended | ||
| 2 | Ana | 72 | Yes | ||
| 3 | Ben | 45 | Yes | FALSE | |
| 4 | Cal | 88 | No | ||
| 5 |
Result: FALSE. Ben's 45 is not at least 50.
Tips
- Use >= rather than > when the boundary value itself should count.
Practise Comparison operators
Try it yourself in a real spreadsheet, with instant feedback on every answer.