Sub topic 7
Replacing Simple IF Logic with MIN and MAX
Prerequisites and the core idea
This chapter assumes you can copy formulas across a forecast, use relative and anchored cell references, and read basic financial model rows such as revenue, tax, cash, and debt.
The IF function chooses between outcomes. MIN and MAX can express a narrower class of IF logic more compactly:
- MIN returns the smaller of its arguments.
- MAX returns the larger of its arguments.
- A cap limits a value from rising above a maximum.
- A floor prevents a value from falling below a minimum.
For example, this formula applies a maximum of 100:
=IF(F20>100,100,F20)The formula returns 100 when F20 is greater than 100. Otherwise, it returns F20. The same logic is clearer as:
=MIN(F20,100)The cap can come from an input cell instead of being hard-coded:
=MIN(F20,$C$4)Here, C4 stores the maximum. The anchored reference keeps the cap fixed when the formula is copied across the forecast.
Replacing a floor with MAX
A floor works in the opposite direction. It prevents a result from dropping below a minimum.
This IF formula prevents a negative result:
=IF(F30<0,0,F30)The equivalent MAX formula is:
=MAX(0,F30)If F30 is 25, the result is 25. If F30 is -10, the result is 0.
A floor can also use an input cell:
=MAX($C$3,F20)This returns whichever is greater: the value in F20 or the minimum stored in C3.
Using MIN and MAX together
You can apply both a floor and a cap by nesting the functions:
=MIN($C$4,MAX($C$3,F20))The inner MAX applies the floor first. The outer MIN then applies the cap. If C3 is 10 and C4 is 100, the result must fall between 10 and 100.
| F20 input | Minimum in C3 | Maximum in C4 | Result |
|---|---|---|---|
| -5 | 10 | 100 | 10 |
| 50 | 10 | 100 | 50 |
| 125 | 10 | 100 | 100 |
This pattern is sometimes called clamping a value. It is useful for rates, bonuses, utilization, working capital assumptions, and other inputs with allowed ranges.
Financial modeling examples
A bonus may equal a percentage of a base amount but cannot exceed a maximum:
=MIN(F20*$C$3,$C$4)C3 contains the bonus rate. C4 contains the maximum bonus. The multiplication calculates the uncapped bonus, and MIN limits it.
Tax often should apply only to positive pre-tax income. A loss should not create negative tax:
=MAX(0,F30)*$C$5F30 contains pre-tax income, and C5 contains the tax rate. MAX creates a zero floor before the tax rate is applied.
Debt repayment can be limited by both available cash and the opening debt balance:
=MIN(F41,MAX(0,F38))F38 contains available cash, and F41 contains opening debt. The inner MAX prevents a negative repayment when cash is negative. The outer MIN prevents repayment from exceeding the debt balance.
When MIN and MAX are not substitutes
MIN and MAX replace simple threshold logic, but they do not replace every IF. Use IF when the branches perform different actions or return different data types.
For example, this formula returns text in one branch and a number in the other:
=IF(F20>0,"Active",0)MIN and MAX are not appropriate for that decision. They are best when all arguments are numeric and the intended result is a floor, a cap, or a bounded numeric value.
Exercise
Exercise
F30 contains pre-tax income, C5 contains the tax rate, and losses must produce zero tax. Rewrite =IF(F30>0,F30*$C$5,0) using MAX.
Show answer
=MAX(0,F30)*$C$5