The Anatomy of an Excel IF Function,
Part 2: Nesting an IF Function
(page 3 of 3)
Whenever we use parentheses in our formulas, they must balance. For every opening parenthesis there must be a corresponding closing parenthesis. If you try to submit a formula which does not contain the same number of open and close parentheses, Excel will help you correct the error. First, Excel will prompt you and tell you that the formula has an error. Excel will make a suggestion as to what it thinks the formula should be. You can accept the recommendation or click "No" to edit the formula yourself. Usually, clicking "Yes" will correct the error.
Also remember that Excel uses color coding to help you write your formula. The last closing parenthesis you type will match the same color (usually black) as the first IF function.
Solution
Now, if you haven't done so, open the IF_Statements.xsl workbook (the file you downloaded). Select cell C3 and type the following formula into the Formula bar text box:
=IF(B3="", "", IF(B3>=0.6, "Passed", "Failed"))
Again, notice the color of the parentheses in the formula bar text box.
At this point, you should conceptually understand how your IF formula works. If you can type the above formula in your formula bar without looking, give yourself an "A."
Now use the fill handle to copy the formula to the cells below, C4:C8. Test your formula. If it doesn't work, carefully check your formula making sure that it is typed correctly. You must be precise. If you leave out one character, your formula will not work, although often Excel will correct some of your errors automatically.
In this tutorial, we learned how to nest an IF function within an IF function, which provides us with more than just two values that can be returned in cell C3. In Part 3, we will learn how to nest several IF functions within an IF function.