The IF function in Google Sheets returns a specified value if a condition holds true and another specified value otherwise. But what if you need to extract the values from a dataset based on more than 2 conditions? Well, then you can use the IF function as the argument of another IF function. These are known as nested IF statements. Using such statements may create complex formulas for many conditions but is very handy for lesser criteria. In this article, we will show you some practical examples of how to use the nested IF statements in Googe Sheets.
Introduction to IF Function in Google Sheets
The IF function returns one value or another based on a logical expression being TRUE or FALSE.
Syntax
Arguments
- logical_expression: This part represents some logical value like TRUE or FALSE.
- value_if_true: This part returns when the value is true.
- value_if_false: This part returns when the value is false.
Return Value
If the statement matches the reference value then the output is TRUE otherwise the value is FALSE.
3 Examples to Use Nested IF Statements in Google Sheets
Here, we will show you 3 practical examples of using nested IF statements in google sheets using different datasets. Let’s start.
1. Calculate Student Fees
The dataset below contains Class, Name, and Fees. Here, we see, every class is assigned a particular fee for a class party.
Let’s describe the steps to calculate student fees below.
📌 Steps:
- First select cell G5 and insert the IF function. Then type F5<=3,20, as the first two arguments.
- Then, again apply the IF function as IF(F5>=9,30,25) for the last argument to complete the formula as below.
=IF(F5<=3,20, IF(F5>=9,30,25))
- Here, instead of writing the condition manually, you can also use cell references to apply the condition.
=IF(F5<=3,C5, IF(F5>=9,C7,C6))
- At last, drag down the fill handle icon and copy the formula into every cell below.
2. Evaluate Performance of Players
Here, the dataset below contains the Player Name, Score and Remark. You see, every player has their individual score.
Let’s describe the steps of evaluating the performance of the players below.
📌 Steps:
- First, select cell D5 and enter the IF function with the condition below. Then type =IF(C5>=95,”Very Good” as the first two arguments.
- Here, the first condition is selecting those players who scored more than 95 as “ Very Good” then the second condition will be selecting those players who scored more than 85 as “Well Done” and ending the condition by rejecting the other players marking “Bad” as below.
=IF(C5>=95,"Very Good",IF(C5>=65,"Well Done","Bad"))
- At last, drag down the fill button and copy the formula into every cell.
Read More: Google Sheets IF Statement in Conditional Formatting
Similar Readings
- How to Use Nested IF Function in Google Sheets (4 Helpful Ways)
- Use IF and OR Formula in Google Sheets (2 Examples)
3. Calculate Student Grades
Here, the dataset contains Student’s Name, Marks, and Grade. Every student has their individual number here.
Let’s calculate the grades of the students using nested IF statements.
📌 Steps:
- First, select cell D5 and enter the IF function with the condition below. =IF(C5>90,”A+” as below.
- Here, the first condition is selecting those students who scored more than 90 as “ A+” and the other conditions will be similar to the first one.
=IF(C5>90,"A+",IF(C5>80,"A",IF(C5>70,"B+",IF(C5>60,"B",IF(C5>50,"C",IF(C5>40,"D","F"))))))
- At last, drag down the fill button and copy the formula into every cell as before.
Alternative to Nested IF Statements in Google Sheets
Here, the dataset below contains the Player Name, Score and Remark. You see, every player has their individual score. Previously we used the nested IF function to evaluate the performance of the players. We can also use the IFS function instead of using the IF function again and again.
Here, follows the steps below to execute this method.
📌 Steps:
- First, select cell D5 and enter the formula as below.
=IFS(C5>=95,"Very Good",C5>=65,"Well Done",C5<65,"Bad")
- Here, instead of using the IF statements multiple times, you can use the IFS function to apply multiple conditions.
- Now, drag down the fill handle and copy the formula into the cells below.
Read More: How to Use Multiple IF Statements in Google Sheets (5 Examples)
Things to Remember
- You must enter the arguments in proper sequence as mentioned earlier.
- Always remember to add text conditions within double quotes.
- You can use the IFS function if the nested IF formula becomes too complex.
Conclusion
In this article, we explained the anatomy of the IF function. We also explained how to use the nested IF statements with some examples. Hopefully, the examples will help you to apply this method to your own dataset. Please let us know in the comment section if you have any further queries or suggestions. You may also visit our OfficeWheel blog to explore more Google Sheets-related articles.