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.

Tuesday, May 20, 2025

Week 33/34 - Reaffirmation of the management and application of the function =IF

 OBJECTIVE OF THE CLASS

Reaffirm the necessary components for managing the =IF function, combining previous knowledge in the management of formulas and functions as well as conditional formatting and data validation.


REMEMBERING THE SYNTAX


The IF function in Google Sheets is a conditional function that allows you to evaluate a condition and return one result if that condition is true and another result if it is false. The basic syntax of the IF() function is as follows:


=IF(condition,result_if_true,result_if_false)


EXAMPLE (PREPARATION FOR THE ACTIVITY "MUSICAL DEL IdeC 2025")

Today we will go directly to preparing the test in a spreadsheet. For this activity you will have to create a completely new file.


  • Before starting in Google Sheets, you will have to get 10 images of some famous people, for example, athletes, actors or actresses, singers, fictional characters, characters from a trilogy of movies or series (remember that it cannot be a drug apology, crimes, drug trafficking, etc.).

  • To do this you will use the Google search engine, but you will use the image filter, the tools button and choose only icon type images. To download the image you will right click on it and select the "Save image as" option. This will store the images on your computer.

  • Now, create a new spreadsheet file in Google Sheets. To begin, you will write down the main instruction in cell B2 (Write down the correct name of each person or character)

  • In row 4, starting in cell B4, you will insert the images you downloaded, leaving a free column between each image. Use the Insert/Image/Image tab on the cell.

  • After inserting all 10 images, you will now mark a cell below each image for someone else to write down each person's name. Just change the background color of these cells to gray.


  • Finally, we program the evaluation of the answer noted in the previous cell with an IF() function. Look at the image.

  • In the example in the image the content of cell B6 is being analyzed. If the name “Michael Jordan” is written there then it will say CORRECT, if it is false then it will say BAD ANSWER. Logically you will have to repeat so that the 10 images are evaluated.

  • In addition to the activity with the =IF function, you will add formulas in which 2 points are awarded for each correct answer in a cell to turn it into a memory-style game.


IMPORTANT: Note that all texts within the IF() function are indicated in quotes, to prevent Google Sheets from confusing them with another function.

When finished you will have to send your file through Classroom.


Wednesday, May 7, 2025

Week 31/32 - Logical functions, IF() function

 OBJECTIVE OF THE CLASS

Know the logical function IF(), which allows situations and results to be analyzed in order to draw conclusions automatically, mainly based on a comparison operation.

INTRODUCTION LOGIC IN FUNCTIONS

As we have already told you, until today we have worked with the tools that give us results, such as those of a formula, function, filters, ordering, graphs, etc. Once we have these results, it is up to us to draw conclusions. For example, if I saw low grades on my report card, you concluded that I am at risk of failing. This is logical reasoning.


Among the functions of a spreadsheet there is a classification called Logical Functions, which do this type of "analysis and conclusion" work, and which are based on the comparison operations that you learned last week.


IF() FUNCTION


This is the first of the functions classified as logical. As will be stated in the introduction, this function will use a compare operation to "decide" which result to return. For example, look at this table with the temperature taken by several people:


The following example uses the IF() function to decide whether to return the word HEALTHY or SICK.



As you can see, the function will respond with whThe =IF function in Google Sheets is used to evaluate a condition. That is, when placing a logical test in the spreadsheet and entering the conditional formula, it will give you two results that can be “True” or “False” as appropriate.


These answers may vary depending on what you put in the syntax. For example, “Affirmative” or “Negative”, “Correct” and “incorrect”, etc. at you program, but it will still depend on the result of the comparison operation.


Syntax of the IF Function
The formula for the conditional If function in Google Sheets is as follows:


=IF(condition;value_if_true;value_if_false)


Remember that when starting a formula in Spreadsheets, you must always place the sign (=) before it. In the space where the condition is located, it is necessary to place the logical proof, for example “A>B”, “A<B”, etc.


With respect to the space where it says “value_if_true” or “value_if_false”, the response will be conditional on the initial condition. In other words, if the condition is correct, “True” will appear, otherwise “False” will appear.


If you want to modify the response words, this is possible by replacing “value_if_true” or “value_if_false” with the answers you want to receive. For example:


=IF(A5<8,”APPROVED”,”FAIL”)