IIF

The IIF function is used to evaluate an expression and return one of two values based on that evaluation.

Syntax

IIF( predicate, trueVal, falseValue )

Remarks

The expression to be evaluated is defined in the predicate parameter. If the predicate is True, the trueValue (parameter 2) will be returned. If the predicate is False, the falseValue (parameter 3) will be returned. IIF always evaluates both the true and false arguments, even though it only returns one of them. This could lead to mathematical errors even when the expression returned is valid, but would not have been valid if the alternative argument had been used.