As we all know, Google sheets is a very versatile and powerful spreadsheet app that allows the user to perform multiple tasks at a time. This also includes the ability to assemble multiple functions of the same or different kinds, to perform developed operations on your worksheet.
A prominent function that can be used is the IF function. In this tutorial, we are going to discuss the IF statement and How to Do Multiple If Statements in Google Sheets .
This function allows you to evaluate a logical expression and returns a certain value if it’s TRUE or if it’s FALSE. The IF function takes the syntax below.
=IF(logical expression, value_if_true, value_if_false)
- Logical Expression means the statement you’re evaluating. It is done with the use of mathematical operations and cell references in the worksheet.
- Value_if_true is where you input the text you want to be returned if the expression is TRUE. It is placed in between quotation marks in the cell.
- Value_if_false. It is not compulsory to add this into the formula syntax. You can also leave the value empty and it would count as FALSE. Its values are placed inside quotation marks also like the value_if_true parameter.
In the sample worksheet below, we have a list of exam scores of students from cells B2 to B10.
We are using the IF function to return values from the list if they are greater than 50. If the number is greater than fifty, it evaluates to TRUE and a PASS text is returned in the result cells in column C and if it evaluates to FALSE, a FAIL text is returned to the result cell.
The formula used would look like this.
=IF(B2>50, “PASS”, “FAIL”)
Step 1: Input the formula in cell C2.
Step 2: Press the Enter key on the keyboard. A PASS text is entered into the cell. This signifies that the score was greater than 50.
Step 3: By dragging down the formula to the other cells, a PASS or FAIL value is inputted into the cells.
Multiple IF Statements.
Here, you can assemble multiple IF statements to generate a joint IF statement. This allows you to add multiple values for each data and return a value based on the outcomes. The joint IF statement takes the syntax below.
=IF(logical_expression, value_if_true, IF(logical_expression2, value_if_true2, IF(logical_expression3, value_if_true3, value_if_false)))
This formula solely depends on the first IF statement inputted. If the first logical expression is true, the formula returns the value_if_true. If the first statement is evaluated as false, the following statement would be evaluated first.
You can also join multiple IF statements and if no statement returns a true value, it would return a false value.
In the sample worksheet below, we have five IF statements joined together in the formula. We have a given condition for each value in column B.
The first IF statement checks the first number in column B to see if it evaluates to a TRUE value. If it evaluates as a FALSE value, it moves to the following IF statement.
The multiple IF statements could get confusing and complex when it gets too long. An alternative function is the IFS function. It is an inbuilt function made specifically for this purpose.
It is very easy to use and understand. It is also very similar to the IF function but it allows multiple conditions in one formula. The IFS function takes the syntax below.
=IFS(condition1, value1, [condition2, value2, …])
- Condition1 is the first expression that is evaluated.
- Value1 is the value that is returned when condition1 is evaluated as TRUE.
- Condition2, Value 2: When the condition1 is evaluated as FALSE, the following condition is evaluated. Added conditions are added to the following expression.
Using the previous sample worksheet, we are grading some exam scores of students. If the first expression is TRUE, the formula will end there. But if the first expression is FALSE, the formula would move on to the following expression.
So the formula looks like this.
=IFS(B2>80, ” Excellent”, B2>70, “Very Good”, B2>50, ” Good”, B2<50, “Poor”)
Step 1: Enter the formula in cell C2.
Step 2: Press the return key. The first expression is true so it returns the value attached to the set condition. Copy the formula into the other cells by using the autofill method or the drag down method.
The IF and IFS functions are important tools for analyzing data in your worksheet. Once you get the hang of this function, you can nest other functions like AND, OR, and ISBETWEEN functions together. Now you know How to Do Multiple If Statements in Google Sheets.
I hope you like the topic treated in this tutorial. Thanks for reading.