Monday, May 26, 2025

Week 35 - 36 NESTED IF()

 CLASS OBJECTIVE 

Learn that using IF() function as a recursive function allows the user to create more than 1 condition in order to analyze the content of a cell in a spreadsheet. This method is also called nested IF() function.





NESTED IF() FUNCTION

The nested IF() function allows the user to analyze, using a comparison operation, the content in a cell. In real life we usually have more than two options, for example, if we ask about one of the colors from the Mexico's flag, we will have 3 possible answers, green, white and red. In this kinds of situations is where we are using the nested IF() function.



In this example, the first IF() asks if the answer is "green", but if not then we use a second IF()

The second if asks if the answer is "white", but if not we use another IF().

Finally, the third if asks if the answer is "red" and if not, we give the final result, "incorrect answer".

If you only read the nested function it might be a little complicated to understand, so we recommend you to observe the next flowchart.





As you can see, when using the IF() function as the result when the first condition is False, allows you to ask for a new condition.

We suggest  you to try this first example, with your teacher guidance, using a spreadsheet before doing the class activity.


CLASS ACTIVITY

In today's activity you are going to create an interactive menu. Just like the last session, the file to complete the activity is going to be available for you in Classroom.

  1. Fill the cell with the text in the image below.
  2. Use data validation to create a list of items with the options: small, medium, large.
  3. Now use a nested IF() function to automatically choose a price for the products depending on the user's choice. Do not put the $ symbol, just the amount.
    • Burger $50, $55, $60
    • Cheese burger $55, $60, $65
    • Fries  $30, $35, $40
    • Club sándwich  $45, $50, $60
    • Hot dog $30, $35, $40
    • Nuggets  $35, $40, $45
    • Soda  $20, $25, $30
    • Milkshake $50, $55, $60

Add the prices for the selected products in the last sections: Total amount.





Finally send your work in Classroom.