Довідка LibreOffice 7.5
Повертає один з двох можливих результатів функції залежно від логічного значення виразу.
IIf (Вираз, Вираз_True, Вираз_False)
Вираз: довільний вираз, який необхідно обчислити. Якщо цей вираз обчислюється як True, то функція повертає результат Вираз_Тruе; інакше функція повертає результат Вираз_False.
Вираз_Тгuе, Вираз_False. Вирази, один з яких буде результатом функції в залежності від обчислення логічного виразу.
IIf evaluates both ExpressionTrue and ExpressionFalse even if it returns only one of them. If one of the expressions results in error, the function returns the error. For example, do not use IIF to bypass a possible division by zero result.
REM Returns the maximum of 3 values
Function Max (A As Double, B As Double, C, As Double) As Double
Max = IIf( A >= B, A, B)
Max = IIf( C >= Max, C, Max)
End Function
REM Bad usage of function IIf
Function Inverse(A As Double) As Double
Inverse = IIf( A = 0, 0, 1/A )
End Function