In this tutorial, we will learn, How to do Multiple if Statements in Google Sheets.
How to do Multiple if Statements in Google Sheets: Step by Step Guide
What is IF Function and How to use it?
If function will check the cell and return a value as ‘TRUE’ or ‘FALSE based on the condition for logical expression.
IF(logical_expression, value_if_true, value_if_false)
- Logical_expression – Logical expressions is the defined condition which is being checked by function .It can be reference to another cell or an expression returning a logical value :TRUE OR FALSE
- value_if_true – Value of the function being returned if the logical_expression is TRUE
- value_if_false – [ OPTIONAL – blank by default ] – Value of the function being returned if the logical_expression is TRUE
How to use IF Function example : ( With Single Condition )
In the below example we are checking the number of fruits greater than 3 by referencing cell B2 which the logical expression B2>3. Once the defined condition is met it returns a Yes or if not it returns a No.
How to Use Multiple if function
Using multiple IF functions we can create a single Nested function and define multiple conditions which will return a logical value depending on the defined condition.
SYNTAX for Nested If function
Using the below syntax we can join multiple IF functions with conditions.
IF(logical_expression, value_if_true, IF(logical_expression2, value_if_true2, IF(logical_expression3, value_if_true3, value_if_false)))
- The above function will first check the first logical expression if the condition is met it will return a value_if_true.
- If the condition is not met it will jump and start evaluating the second IF Function and so on.
- You can write as many IF functions as you need based on your requirement.
In the below example we will go through the usage of the Nested IF Function.
= if (B2<3,"YES",if(B2>8,"YES",if(B2<5,"YES")))
In the following example, we have used 3 IF functions resulting in a Nest IF function.
In this function, the first logical expression B2<3 is being checked, as the condition is not met it returns a FALSE. Similarly, for the second IF function, the condition is not met and it again returns a value FALSE.
However, when the third IF function is checked the condition is met and it returns a YES.
How to use IFS Function in Google Sheets
If you don’t want to write and use multiple if functions to return a value. You can use the in-built IFS function in Google Sheets which makes our task easier.
IFS function checks multiple defined conditions and accordingly returns a value once it encounters a true condition.
IFS(condition1, value1, [condition2, value2, …])
- condition1 – The first defined condition which will be evaluated which can be a boolean ,number or an array.
- value1 – This is the value which being returned after the condition1 is met as TRUE.
- condition2, value2 – If the first condition is not met and returns a FALSE value ,this additional second condition2 will be evalauted .
Here is an example of How to use the IFS Function.
In this example, we have a list of Football teams . We have defined a condition as “B2>20” which means if a team has points more than 20 it will be qualified else not qualified.
The IFS function will check cell B2 for the condition and if met it will return Qualified.
IFS function makes it simple to use multiple conditions to get the result.
We hope this tutorial on How to do Multiple if Statements in Google Sheets was helpful.
Related articles :