Mar 10, 2021 11:55 PM
Hello dear community!
I built a nested formula, and Airtable does confirm it and says the field was updated (The “field updated” message did popup). Although when I checked the field again, the formula seemed to not be updated…
This is the formula.
IF({field}= TRUE(),“value 1”,“value 2”,IF({field 2}= TRUE(), “Value 3”))
Is there something wrong in what I am doing? Is this a bug?
Thank you in advance!
Mar 11, 2021 09:14 AM
You have too many arguments in your first IF() statement. An IF() takes three arguments, and you have given it four.
Mar 12, 2021 09:04 PM
Hi @Asaf_Pedro!
I’m usually the one asking questions in these forum, but would like to finally be able to provide someone else with an answer, so I’ll try to do this with your question and hopefully I’ll make sense.
IF arguments work like this:
IF({field has a value},
'do this',
'otherwise do that'
)
OR
IF({field}='has a specific value',
'do this',
'otherwise do that'
)
Additionaly, the way your example shows you don’t have to ask the if the condition is true
{field 2}=TRUE()
If field 2 has a value - wheather that be text, a date or a checked checkbox - it is already registering as true.
If you on the other hand have a value called “TRUE()” that you are looking for then you need to ask for that specifically.
{field 2}=‘TRUE()’
In your case you want to achive three different outputs (three different values), but the way it is structured Airtable reads it as you wanting four different values.
IF({condition 1 is met},‘do this’,‘otherwise do that’, IF({condition 2 is met}, ‘Do this instead’,‘or nothing at all’))
Or in your case
IF({field}=TRUE(),“value 1”,“Value 2”),IF({field 2}=TRUE(),“Value 3”,“Value 4”))
That you haven’t written out “value 4” doesn’t matter, Airtable reads it as such anyway.
If you indeed want it to actually give you four different outputs you can simply have the formula say
IF({field},'value 1','Value 2')&''&IF({field 2},'Value 3','Value 4')
No need to nest the formula.
If you on the other hand want just the three different outputs, then you can achive this by changing the order of your conditions and nesting the formula.
IF({field 2},'Value 3', {field}, 'value 1','value 2'))
and a bit prettier with indentations:
IF({field 2},
'Value 3',
IF({field},
'value 1',
'value 2'
)
)
I hope that all makes sense.
Mar 13, 2021 10:21 AM
Thank you so much! Although, It’s a bit confusing, that “airtable” confirmed the formula update rather than say it’s an error. :slightly_smiling_face:
Mar 13, 2021 10:24 AM
Thank you so much! I really appreciate the thorough explanation! Looking forward to trying it out <3!
Hopefully I’d be able to help as well ;), when I am more adamant with “airtable”.