This function returns one value if a condition you
specify evaluates to TRUE and another value if it evaluates to FALSE.
The IF function is used to conduct conditional tests
on values and formulas.
Syntax: IF
(TestCondition , TrueExpr, FalseExpr)
- TestCondition : is any value or expression
that can be evaluated to TRUE or FALSE.The condition may be one
or more conditions joined together with an "and" or
"or", and the conditions maybe from 1 to n.
- TrueExpr : The "True Expression"
is the expression that directs the program what action to perform
if the condition specified under "Test Condition" above
is correct and returns a value "True". TRUE is the value
that is returned if logical test is TRUE.
- FalseExpr : The "False Expression"
is the expression that directs the program what action to perform
if the condition specified under "Test Condition" above
is incorrect and returns a value "False". FALSE is the
value that is returned if logical test is FALSE.
Remarks
- The IF function, can be used whenever a decision
has to be made, based on whether a condition is "TRUE"
or "FALSE". Depending upon the action to be performed,
the other two parameters of the function tell the function what
task to complete.
- If the condition &/or conditions, are "TRUE"
then the "trueExpr" action is performed.
- If "FALSE" is returned then the "falseExpr"
action is performed.
Example
=IF (NUM 1< NUM2, "Num2 is
greater", "Num1 is greater") |
This example returns the statement, "Num1 is
greater" if the test condition returns false, and it returns
the statement "Num2 is greater" if the test condition returns
true.
Num1 and Num2 are member names, and in a real world
example they will need to be referenced completely (with dimension
and cube names)