Skip to main content

I have a nested IF formula that is working well, but is excruciatingly hard to maintain because it’s so many levels deep. It would be easier to maintain if I could use IFS(), but that doesn’t seem to exist in Airtable. Is there anything else similar I could use? 

The logic is (in pseudocode) : 

IF regex_match(MYFIELD, expr1) then regex_extract(MYFIELD,pattern1)

ELSIF regex_match(MYFIELD, expr2) then regex_extract(MYFIELD,pattern2)

ELSIF …. etc for far too many more patterns …

ELSE blank()

ENDIF

I don’t think I can use SWITCH or CASE (if these even exist in Airtable) because each if statement clause is different. Essentially, I have a string that may contain one and only one of a dozen substrings, and I need to detect and extract these substrings whenever they show up. Fun times.

Hey ​@nroshak,

I’ve definitely had frustrating moments dealing with hard-to-manage nested if statements as well!

You’re right the Airtable’s SWITCH() statements won’t work for your case.

Unfortunately, Airtable doesn’t have the equivalent of Excel IFS() but I’ve found that formatting my If statements like so have been helpful

 


I keep the condition unindented, the output indented and you can add some white space to separate things out. The number of brackets at the end matches the number of IF functions used as well.

Definitely not as easy as using IFS() but this is the best I got, sorry!


Honestly, this helps, thanks! Also thanks for confirming there is no IFS() equivalent.