Explanation
This formula uses the MIN function as an alternative to the IF function .
Although MIN is frequently used to find the minimum value in a larger set of numbers, it also works fine with just two values.
Inside MIN, the first value is hardcoded as 1, the equivalent of 100% when formatted as a percentage . The second value is the result of B5 divided by C5. The MIN function simply returns the smaller of the two values:
- When B5/C5 is < 1, the result is B5/C5
- When B5/C5 is > 1, the result is 1 (100%)
- When B5/C5 = 1, the result is 1 (100%)
In the example shown, you can see that E13 and E14 are “capped” at 100%.
You can use the MAX function in a similar way to guarantee a minimum value.
With IF
For reference, the equivalent formula with the IF function looks like this:
=IF(B5/C5>1,1,B5/C5)
If the result of B5/C5 is greater than 1, return 1. Otherwise, return B5/C5. This formula works fine but is more complex and redundant.
Explanation
This formula uses the MIN function to make a decision that might otherwise be handled with the IF function . Although MIN is usually used to return the minimum value in a data set with many numbers, it also works fine for the “lesser of the two” situations.
Inside MIN, the value in C6 is multiplied by 10%, and the result appears at the first number given to MIN. The number 1000 is supplied as the second value. The MIN function simply returns the smaller of the two values:
- When C610% is < 1000, the result is C610%
- When C6*10% is > 1000, the result is 1000
- When C6*10% is = 1000, the result is 1000
Replacement for IF
To return the smaller or greater of two values, MIN and MAX can be a clever way to avoid a more complicated IF formula .