How does Quora affect the stack overflow

How to insert multiple IF statements in one cell in Google Sheets

I'm trying to change the value of a cell in Google Sheets based on the value of an adjacent cell. This adjacent cell gets its value from the color of the adjacent cell using the formula from this Quora answer. So the value of the cell should change based on the hex code resulting from the color of the first cell. There are currently four possible hexadecimal values. So I tried to put four different IF statements in the same cell. Therefore, the value is changed based on this.

My first attempt resulted in an error parsing the formulas:

It is clear that you cannot simply separate statements with commas. Based on this stack overflow question, I tried this code with nested IF statements:

This also leads to an error when parsing the formulas.

Can I just put multiple IF statements in the same cell that are appropriate for my code?


Instead of:

Note that the second parameter must be an ordered list.

The problem in the examples is the bracket. Apply them correctly.

The function should have two and optionally a third parameter.

The specific problem with

  • The first example is that the outer has too many parameters.
  • The second example is that those of the outside do not return or

In Google Sheets, the function parameters are separated by commas (or semicolons if your spreadsheet uses commas as decimal separators). When parentheses are used to enclose multiple operations and functions in a function, they are considered parameters of the function that contains them.

A common practice is to put the inside as that, but it could be done in many ways. Add in something other than and is called or just.

Below is an example of a formula with three, two of which are used to determine that of the parent. For the sake of readability, a multiline and vertical alignment of the bracket style is used

The above style could be used when writing Google Sheets formulas. I found it useful for debugging formulas.

I just figured out how to combine whether and or.


So for your example:

Source: Combined use of IF, AND and OR functions in the Google Doc spreadsheet.

For example, you can nest IF statements

Would work


For example, you could use a nested IFAND

Would work too.

You were offered theory and better approaches, but to answer precisely:

Can I just put multiple IF statements in the same cell that are appropriate for my code?

please try:

That is, your second attempt without the first opening bracket and without the last closing bracket.

We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.