Use the IF function, one of the logical functions, to return one value if a condition is true and another value if it's false.
Syntax
=IF(condition, trueValue, falseValue)
For example:
- =IF([Field 1] > [Field 2], "Over Budget", "OK")
- =IF([Field 1] = 500, [Field 3] - [Field 2], "")
Argument name | Description |
---|---|
condition (required) | The condition you want to test. |
trueValue (required) | The value that you want returned if the result of condition is "true". |
falseValue (required) | The value that you want returned if the result of condition is "false". |
Examples
Actual Expense | Predicted Expense |
---|---|
$1,500 | $900 |
$500 | $900 |
$525 | $925 |
=IF([Table]![1][1] > [Table]![2][1], "Over Budget", "OK") | Because the actual expense of $1500 ([Table]![1][1]) exceeded the predicted expense of $900 ([Table]![2][1]), the result is Over Budget . |
=IF([Table]![1][1] < [Table]![2][1], "true", IF([Table]![1][2] > [Table]![2][2], "over budget", "OK")) | The first IF function is false. Therefore, the second IF statement is calculated and because it too is false, the result is OK. |
=IF([Table]![1][3]=500,[Table]![2][3]-[Table]![1][3],"") | Because [Table]![1][3] equals 500, the Actual Expense $500 is subtracted from Predicted Expense $925 to tell you how much over budget you are. The result is 425. If [Table]![1][3] didn't equal 500, then empty text ("") would be returned. |
=IF([Table]![1][1] < [Table]![2][1], "true", IF([Table]![1][2] > [Table]![2][2], "over budget", "OK")) | The first IF function is false. Therefore, the second IF statement is calculated and because it too is false, the result is OK. |
Updated over 1 year ago