Comparing Values With Operators
Use greater-than, less-than, and equals to build logical tests.
Comparing Values With Operators is a free Excel Formulas Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Excel Formulas Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What Is a Comparison Operator?
An IF test is only as smart as the question you ask. Comparison operators are the symbols that let you ask those questions.
They compare two values and hand back a simple answer: TRUE or FALSE. That answer is exactly what IF needs to choose an outcome.
The Six Operators
There are six comparison operators you will use constantly:
=equal to>greater than<less than>=greater than or equal to<=less than or equal to<>not equal to
Each one produces TRUE or FALSE when placed between two values.
Greater Than and Less Than
Use > and < for clear comparisons that exclude the boundary.
If A2 holds 80, then A2 > 75 is TRUE because 80 is bigger than 75. But A2 < 75 is FALSE.
Drop that test straight into IF to label high scorers:
=IF(A2 > 75, "High", "Normal")Including the Boundary
What if the cutoff itself should count? Use >= or <=.
A passing grade of "60 or higher" must include 60 itself. So A2 >= 60 is correct, while A2 > 60 would wrongly fail a student who scored exactly 60.
Choosing between > and >= is one of the most common decisions in logical formulas.
=IF(A2 >= 60, "Pass", "Fail")Testing for Equality
Use a single = inside the test to check whether two values match.
To see if a status cell says "Done":
Remember the very first = starts the formula. The second = is the equality comparison inside the test.
=IF(B2 = "Done", "Complete", "In progress")Comparing Text Values
Operators work on text too, not just numbers. When comparing words, wrap the text in double quotes.
Text comparison with = ignores capitalization in most spreadsheets, so "YES", "Yes", and "yes" all count as equal to "yes".
This makes checking categories, labels, and answers very easy.
=IF(C2 = "Shipped", "Notify customer", "Wait")Not Equal To
The <> operator means "is different from". It is TRUE whenever the two values do not match.
To flag any row that is not yet approved:
This is handy for catching exceptions: anything other than the expected value triggers the action.
=IF(D2 <> "Approved", "Needs review", "")Operators Return TRUE or FALSE Alone
You can even type a comparison by itself, without IF, to see the raw result.
Entering =A2 > 100 in a cell shows TRUE or FALSE directly. This is a great way to test your logic before wrapping it in IF.
Once the comparison gives the right TRUE/FALSE, you know your IF test will behave.
=A2 > 100Worked Example: Budget Check
Column A holds spending and column B holds the budget for each department. You want to flag overspending.
The question is "Did spending exceed the budget?" which is A2 > B2. For row 2:
Any department whose spending beats its budget instantly shows the warning.
=IF(A2 > B2, "Over budget", "Within budget")Choosing the Right Operator
Picking the correct operator is the difference between a right and wrong answer. Ask yourself:
- Should the cutoff value itself count? Use
>=or<= - Must it be exactly something? Use
= - Should it be anything but a value? Use
<>
A single misplaced operator can silently miss the boundary cases.
Same in Excel and Sheets
All six operators behave identically in Microsoft Excel and Google Sheets. The symbols =, >, <, >=, <=, and <> are universal.
Master them once and you can build logical tests anywhere a spreadsheet runs.
Quick Check
Pick the operator that matches the requirement.
Recap: Comparison Operators
You now have the building blocks of every logical test:
- Six operators:
=,>,<,>=,<=,<> - Each compares two values and returns TRUE or FALSE
- Use
>=or<=when the boundary should count - Wrap text in quotes; capitalization is ignored for equality
- Test a comparison alone before placing it in IF
Next you will decide what IF actually returns once the test is answered.
=IF(A2 >= B2, "Target met", "Below target")Frequently asked questions
Is the “Comparing Values With Operators” lesson free?
Yes — the full text of “Comparing Values With Operators” is free to read here on the web, and the Excel Formulas Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Excel Formulas Academy course, upgrade to CoddyKit PRO.
What will I learn in “Comparing Values With Operators”?
Use greater-than, less-than, and equals to build logical tests. You practise Excel Formulas Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Excel Formulas Academy?
No prior experience is required. Excel Formulas Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Comparing Values With Operators” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Excel Formulas Academy lesson?
Yes. Every Excel Formulas Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- How the IF Function Thinks
- Comparing Values With Operators
- Returning Text or Numbers From IF
- Common IF Mistakes to Avoid