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.
[Note: Want to learn even more about advanced Excel techniques? Watch my free training just for engineers. In the three-part video series I'll show you how to easily solve engineering challenges in Excel. Click here to get started.]
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:
=IF(C4<2100,”Laminar”,
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.
[Note: Want to learn even more about advanced Excel techniques? Watch my free training just for engineers. In the three-part video series I'll show you how to easily solve engineering challenges in Excel. Click here to get started.]
This third argument will be:
IF(C4>4000,”Turbulent”,”Transitional”)
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:
=IF(C4<2100,”Laminar”,IF(C4>4000,”Turbulent”,”Transitional”))
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.
[Note: Want to learn even more about advanced Excel techniques? Watch my free training just for engineers. In the three-part video series I'll show you how to easily solve engineering challenges in Excel. Click here to get started.]