In the last section, you saw how an IF function can be used to return one of two possible values. What if you have more than two possible results? Nested IF functions can be used for three or more possible outcomes.
Our example spreadsheet shows a simple case where a Reynold’s number will be evaluated to determine whether the flow is laminar, turbulent, or transitional.
Recall the syntax for the IF function: the second argument is returned if the condition is true, and the third argument is returned if the condition is false. So far, we have returned text strings, but Excel can also perform a function specified in an argument.
A single IF statement can only return 2 results. We can add a nested IF statement as one of the arguments to handle all three possible cases. Begin the function as follows:
This tells Excel that if the statement C4<2100 is true, it should return the string “Laminar.” However, if that statement is false, there are two possibilities. Therefore, we’ll use another IF statement as the value_if_false argument.
This third argument will be:
The nested IF function will return the string “Turbulent” if the Reynold’s number is greater than 4000. Otherwise, it will return the string “Transitional.” The completed formula will be:
This function should meet the criteria on the right side of the worksheet. First, the function evaluates if the Reynold’s number is less than 2100; if so, it returns the string “Laminar.” If that statement is false, it performs the second IF function to check if the Reynold’s number is greater than 4000. If it is, it returns “Turbulent,” otherwise it returns “Transitional.” You can verify that your function works properly by entering different values for the Reynold’s number.