Hello there! Welcome to TeqTog and in this article, I am going to show you how to create multiple “if statements” in one cell.
Before I can get started, let me tell you about all the other amazing content in TeqTog and that you should definitely check them out, if you already haven’t!
Alright then, I am going to start by explaining what exactly is the function of the “if statement”, in case you are using this function for the first time or are quite new to it.
What is the IF Statement in Google Sheets?
So, the IF statement basically lets you test a logical statement. Google Sheets will generate a certain value if that logic is true and generate another certain value if that logic is invalid. I am going to show you how Google Sheets does this with a simple example.
As you can see in my example, I have a set of data in the first column. In my second column, I plan on testing my logic, which is why I named the column “What if?”
Now, if my logical condition is true, I want Google Sheets to tell me “yes” and, if my logical condition is false, it should show me “no’.
How do I achieve this?
To do this, you need to learn the IF function formula.
The formula goes like this:
=IF (logical_expression, value_if_true, value_if_false)
- Logical expression – this is the logic that I want to evaluate in my data.
- Value if true – this is the value I want to see, if that logic is true.
- Value if false – and this, is the value I want to see, if my logic is false.
Therefore, I will type in my formula like this:
As you can see, for my logic I have chosen to test if the value in cell “A2” is greater than ten. So, “A2>10” was my input. Then, I gave “yes” if the value is actually greater than ten. Lastly, I wanted my spread sheet to return me the value “no” if my logical condition is false.
Multiple IF Statements Nested Together in One Cell
Now that you got a general idea about Google Sheet’s IF Statement function, I can show you how you can bring together multiple IF statement in one cell.
Basically, to have multiple IF statement in one cell, your IF statement syntax will be much bigger.
- The easy thing to remember is, when using multiple IF statement: instead of giving your input for “value_if_false”, you just give another IF statement.
- =IF (“logical_expression”, “value_if_true”, IF (……..))
I will consider another set of data for this example.
Now, suppose I want my spread sheets to tell me whether the data in the cell is equal to one, five, three or seven. Moreover, if the data in the cell is not equal to any of my conditions, then I want my spread sheet to return “none of these numbers”.
Now, you should pay close attention to the syntax of the IF statement function.
=IF (A2=1, “One”, IF (A2=5, “Five”, IF (A2=3, “Three”, IF (A2=7, “Seven”, “None of these numbers”))))
I know it looks confusing at first glance, but it’s pretty simple once you understand it.
See, at the end of my first condition (which was to test if a data is equal to one); instead of saying that my spreadsheet should return “no” if a data is not equal to 1, I just continued with my second condition (which was to test if the data is equal to five).
I continued till my fourth condition and then closed my syntax with the input “none of these number” if all of my given logical conditions turn out to be not true. Afterwards, I closed with the parenthesis “))))” because I needed to close the four logical conditions I gave.
I have given my formula. Now, I just need to hit “Enter”.
To fill out the rest of the cells, I just selected the cell with the first result (B:2) and dragged it down to the last cell (B:7).
This pretty much wraps up on using multiple IF Statements in Google Sheets. I hope my tutorial was useful for you.
Best of luck!
Also Read Our Others Google Sheets Tutorial Articles: