Sub topic 2
Comparisons that return TRUE or FALSE
This chapter assumes you know cell references, relative and absolute references, and how a forecast uses columns for time periods. You should also know basic terms such as revenue, tax, cash, and debt.
A spreadsheet comparison tests whether one value relates to another in a specified way. The result is a logical value: TRUE or FALSE.
For example:
=F10>0This returns TRUE when the value in F10 is greater than zero. It returns FALSE when the value is zero or negative. The result does not calculate an amount. It answers a yes-or-no question that another formula can use.
Comparison operators
Excel uses operators to compare numbers, dates, text, and cell references.
| Operator | Meaning | Example |
|---|---|---|
| `=` | Equal to | `=F10=G10` |
| `<>` | Not equal to | `=F10<>G10` |
| `>` | Greater than | `=F10>0` |
| `<` | Less than | `=F10<0` |
| `>=` | Greater than or equal to | `=F10>=C10` |
| `<=` | Less than or equal to | `=F10<=C11` |
The first = in each example tells Excel that the entry is a formula. A second = can be the comparison operator.
Comparisons are useful because they separate a model's condition from the action taken when that condition is met. For instance, F30>0 tests whether pre-tax income is positive. A later IF formula can use that result to calculate tax only when the condition is true.
Comparing dates
Excel stores dates as numbers, even though it displays them in a date format. This allows date comparisons to work like number comparisons.
Suppose row 5 contains period dates. The model starts on the date in C10 and ends on the date in C11. These formulas test the boundaries:
=F$5>=$C$10
=F$5<=$C$11The first formula asks whether the period is on or after the start date. The second asks whether it is on or before the end date. Anchoring row 5 and cells C10 and C11 makes the formula safe to copy across the timeline.
A comparison with TRUE or FALSE can be displayed directly while building or auditing a model. It can also become the condition inside an IF formula, which converts the logical result into a number, text label, or calculation.
Checking text and blanks
Comparisons can test text values, but text must be enclosed in quotation marks:
=C2="Base"
=C2<>"Downside"The first formula returns TRUE only when C2 contains the text Base. Text comparisons can be affected by spelling and extra spaces. A value such as Base , with a trailing space, may not match Base.
To test whether a cell is empty, use:
=C5=""This often returns TRUE for a genuinely empty cell and for a formula that returns an empty text string. If zero is a meaningful value, do not use a blank test as a substitute for a zero test. These questions are different:
=C5=""
=C5=0Reading TRUE and FALSE in a model
A TRUE or FALSE result is not automatically a problem. It is evidence about the model's current state.
For example, if the period date is before the start date, F$5>=$C$10 returns FALSE. That is expected if the model has not reached its start period. If every period returns FALSE, however, check the dates, units, and cell references.
Use temporary check rows when constructing a model. A row containing comparisons can make the model's behavior visible before you combine those comparisons into calculations.
When reviewing a comparison, check that both sides use compatible values. A date compared with text that only looks like a date can produce an unexpected result. Also check whether the boundary should be included. Use >= for “on or after” and > for “after.”
Exercise
A forecast period in F5 is 31 December 2026. The start date in C10 is 1 January 2027. What does =F$5>=$C$10 return, and why?
Show answer
It returns FALSE because 31 December 2026 is before 1 January 2027.