Examples of nested IF statements
An IF Statement with more than 2 outcomes is called a
Nested IF Statement
. Because an IF statement only allows 2 potential results, you can put another IF Statement inside of the existing 1 (nesting) to add more results. Refer to the following examples of nested IF statements:Basic IF statement
[IF(formula, true, false)]
Example 1
- [IF (hungry = TRUE, then eat, otherwise do nothing)]
- The statement will show "If I'm hungry, I will eat otherwise I will do nothing"
Example 2
- [IF(Project actual complete date(Project) <> "", Tracking Description description(Project tracking description(Project)), "")]
- The statement will show "If the project's complete date is not blank, then print the tracking description, otherwise print nothing.
Nested IF statement
[IF(formula, (IF(formula, true, false)), false)]
Example 1
- [IF (hungry = TRUE, then (IF thirsty = TRUE, then eat & drink, else eat), otherwise do nothing)]
- The statement will show "If I'm hungry, so then if I'm thirsty as well I will eat & drink, otherwise I will just eat, but if I'm not hungry, I'll do nothing"
Example 2
- [IF(Project actual complete date(Project) <> "", IF(Tracking Description description(Project tracking description(Project)) = "Canceled", "FLAG FOR REVIEW", Tracking Description description(Project tracking description(Project)), "")]
- The statement will show "If the project's complete date is not blank, then if the tracking description is "canceled" print FLAG FOR REVIEW, but if not print the tracking description, otherwise print nothing.
Example 3
- [IF (hungry = TRUE, then (IF thirsty = TRUE, then eat & drink, else eat), (IF thirsty = TRUE, drink, otherwise do nothing))]
- The statement will show "If I'm hungry, so then if I'm thirsty as well I will eat & drink, otherwise I will just eat, but if I'm not hungry, I'll see if I'm thirsty and if I am, I'll drink, otherwise I'll do nothing"