Menu
Coddy logo textTech

Comparison Operators

Part of the Fundamentals section of Coddy's Excel journey — lesson 36 of 42.

The condition inside an IF is built from a comparison operator. There are six, and together they can ask any yes/no question about numbers:

>    greater than
<    less than
>=   greater than or equal (at least)
<=   less than or equal (at most)
=    equal to
<>   not equal to

The odd one out is <>, Excel's way of saying not equal. =IF(B2<>B1,"different","equal") shows different whenever the two cells don't match.

A curious fact: you can type a comparison as a formula all by itself, like =B2>B1. On this worksheet it shows 1 when the comparison holds and 0 when it doesn't, a raw yes/no as a number. It's a neat trick for peeking at a condition, but 1s and 0s make for cryptic spreadsheets. Wrapping the comparison in an IF turns that raw answer into words anyone can read.

Choosing between the close cousins matters: > versus >= only disagree when the two sides are exactly equal, and that's precisely where off-by-one bugs live. When you write a condition, always ask yourself: what should happen at the boundary?

challenge icon

Challenge

Easy

A small sales sheet: A1 says Target with the target in B1, and A2 says Sales with this month's sales in B2.

Write three IF formulas, each using a different comparison operator:

  1. In C1: show hit if sales are at least the target, otherwise missed
  2. In C2: show under if sales are below the target, otherwise not under
  3. In C3: show different if sales and target are not equal, otherwise equal

Use the exact lowercase words above. The tests will try sales above, below and exactly equal to the target.

Try it yourself

Sheet1
ABCDEFG
1Target100
2Sales130
3
4
5
6
7
8
9
10
11
12
13
14
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals