6.1.2.8.1.11 IIf

Function Declaration

 Function IIf(Expression As Variant, TruePart As Variant, FalsePart As Variant) As Variant 

Parameter

Description

Expression

Variant containing the expression to be evaluated.

TruePart

Variant, containing the value to be returned if Expression evaluates to the data value True.

FalsePart

Variant, containing the value to be returned if Expression evaluates to the data value False.

Runtime Semantics.

§ Returns one of two parts, depending on the evaluation of an expression.

§ IIf always evaluates both TruePart (first) and FalsePart, even though it returns only one of them. For example, if evaluating FalsePart results in a division by zero error, an error occurs even if Expression is True.