IIf() |
Working with Formulas > Functions Used in Formulas > Other Functions > IIf()
IIF() returns one of two values, depending on the value of a given logical condition. If the Boolean test is true, IIF() returns the true value, otherwise it returns the false value. The true and false values may be any valid type, provided they are compatible types, such as the numeric, double and integer types.
Function Format
IIF(Boolean test, true value, false value)
Return Value
IIF() returns a value having a type compatible with the types of the true and false values
Examples
IIF(1 + 1 = 2, "CORRECT", "INCORRECT") = "CORRECT"
IIF(1 + 1 = 3, "CORRECT", "INCORRECT") = "INCORRECT"
IIF("A" + "B" = "AB", 1, -1) = 1
IIF("A" + "B" <> "AB", 1, -1) = -1 |