How to☝️ Do Multiple IF Statements in Google Sheets

To do multiple IF statements in Google Sheets, click on the cell where you need to have the result, move to the Formula bar, and type the formula =IF(A1<20, “A”, IF(A1<40, “B”, IF(A1<60, “C”, IF(A1<80, “D”, “WRONG”)))). You can apply the conditions with your own values instead of the values we suggest here. Next, hit Enter

Scroll down to learn how IF statements work in Google Sheets and сheck out several examples to see how it’s done! 

A Quick Recap: How IF Statements Work in Google Sheets

In Google Sheets, an IF statement tests a value for a certain condition. If that condition is met, it returns one result; if it is not met, it returns another result. Additionally, you can use multiple IF statements in Google Sheets to test multiple conditions.

To use multiple IF statements in Google Sheets, you need to use the nested IF() function. IF() nested functions are used to test multiple conditions at once. The syntax for this IF() function is IF(condition1, value1, IF(condition2, value2, …)).

In every part of the IF function, you specify both the condition that you want to test and the value that should be returned if the condition is met. If you want to use several conditions, each one must be surrounded by parentheses.

For a better understanding, several examples are presented below that show the use of the IF function with multiple statements. Let’s get down to business and take a look at the process!

Using the IF Function

Let’s explore the IF function.

  1. Select the cell where you want the result.
  2. Go to the Formula bar and enter the formula with IF statements. In our example, we use =IF(A1<20, “A”, IF(A1<40, “B”, IF(A1<60, “C”, IF(A1<80, “D”, “WRONG”)))). A1 is the cell with the value being tested. 

Using the IF Function

  1. Press the Enter key on your keyboard. 
  2. Drag the cell with the result downward from the icon in the lower right corner to apply the conditions to the rest of the list.

The IF Function

Voila! Here it is!

Multiple IF Statements in Google Sheets FAQs

You can learn more about multiple IF statements in Google Sheets in this section!

Can an IF condition have multiple statements?

Yes, it’s possible to have multiple IF conditions in a single statement. To do this, you’ll need to use the AND or OR operators.

We use the following example with an AND operator:

Can an IF condition have multiple statements

To set up a formula like this, highlight the blank cell where you need the result, go to the Formula bar, and type the formula =IF(AND(A1>20, A2>20, A3>20), SUM (A1:A),”DONE”), using your own values. Hit Enter and drag the cell with the result downward. 

Alternatively, you can use the formula with the OR operator: 

Simply click on a cell, move to the Formula bar, enter =IF(OR(A1>0, A2>0, A3>0), SUM (A2:A),”DONE”), and press Enter. Drag the result down through the rest of the list. 

The IF Function with the OR operator

How do I use an IF statement with multiple conditions in Google Script?

To do IF statements with multiple conditions in Google Script, go to the Extensions tab and select the Apps Script.

How do I use an IF statement with multiple conditions in Google Script

Next, in the Code section, enter the following code, using your own values:

function myFunction() {

    if (45 < 20) {

        return “A”;

    } else if (45 < 40) {

        return “B”;

    } else if (45 < 60) {

        return “C”;

    } else if (45 < 80) {

        return “D”;

    } else {

        return “WRONG”;

    }

}

Click Run.

The IF statement with multiple conditions in Google Script

 

More Google Sheets Tutorials
More Microsoft Excel Tutorials
Share This Post
Daniel Smith
Daniel Smith
Daniel Smith is automation consultant with a passion for technology, data, AI, and machine learning.

The Spreadsheet Daddy add-on rebrands to Synterrix. Click here to learn more.

X