Help

Re: Nesting IF Function for multiple fields

759 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Eric_Romoff
4 - Data Explorer
4 - Data Explorer

Hi Everyone,

I’m trying to nest a long string of “IF” statements to populate a field and keep getting errors back (Sorry, there was a problem saving this field). I think it might be because I’m targeting different cells with my “IF” parameters…

Can someone help me design the correct formula to handle the following:

IF({CELL1}, FALSE(), “INPUT1”), IF ({CELL1}, TRUE(), “INPUT2”), IF ({CELL2}, TRUE(), “INPUT3”) IF ({CELL3}, TRUE(), “INPUT4”) and so on… needing about 8 of these in total.

Any help would be greatly appreciated!

2 Replies 2

You’re getting errors because the IF()s aren’t nested they’re comma separated (you can’t have loose commas outside of quote marks or within a function) and there’s spaces between “IF” and the parenthesis. Each of your IF()s have three arguments already which means they can’t really be nested. The format of an IF() statement is

IF(
   condition being checked, 
   value to output if condition is true, 
   value to output if condition is false
)

In a nested IF() statement, the true and/or false value is replaced with another IF() statement which is not what you’ve done: you have four complete IF() statements separated by a comma.

Essentially you’re saying "If {CELL1} has any value then output “false”, if {CELL1} has no value then output “INPUT1”, as well as well as a few other checks which would concatenate the result of those checks to the end of either FALSE or INPUT1. To write that logic in the correct syntax it would look like:

IF({CELL1}, FALSE(), "INPUT1") & " " & 
IF({CELL1}, TRUE(), "INPUT2") & " " &  
IF({CELL2}, TRUE(), "INPUT3") & " " & 
IF({CELL3}, TRUE(), "INPUT4")

Since they aren’t nested and the conditions don’t appear to be mutually exclusive, the result of your formula with proper syntax might look like this:

INPUT1 INPUT2 INPUT3 INPUT4

I suspect you did actually want these nested, and assuming you’re trying to ask Does {CELL1} = FALSE() and not Does {CELL1} have a value, this is what it would look like nested:

IF({CELL1} = FALSE(), "INPUT1", 
IF({CELL1} = TRUE(), "INPUT2", 
IF({CELL2} = TRUE(), "INPUT3",
IF({CELL3} = TRUE(), "INPUT4"))))

Welcome to the Airtable community!

Kamille has great advice on how to write nested IF statements. However, she had to make several guesses regarding what you want. If her formula doesn’t work for you, can you please post screen shots of your data and the desired result?

I also have a slightly different syntax for writing nested IF statements. I am not using your field names for output values and I am not sure what you want. Also, depending on your cell values, it is not necessary to use = FALSE() or = TRUE() as you can directly test the “truthyness” of the value.

IF({condition1},
  "result1",
IF({condition2},
  "result2",
IF({condition3},
  "result3"
)))