Help

Nested IF Statements with Two Columns/Conditions

Topic Labels: Formulas
Solved
Jump to Solution
3326 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Embrace_Your_Hu
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello all,

This is my first post to the community. I’ve seen other posts similar to this topic, but they don’t quite address what I’m trying to achieve.

I’m having an issue with a nested IF statement and not sure whether a combination SWITCH/IF would be best for this formula.

I have two columns - column 1 (Date) and column 2 (Location) that is single select. I want a third column (Status) that returns a value based on what is populated in the first two.

Logical Argument 1: If column 1 (Date) is not blank OR column 2 (Location) is ‘Outside Area’, the Status column should return “Yes”.

Logical Argument 2: If column 1 (Date) is blank the Status column should return “No”.

Nested If Statement

Any help would be greatly appreciated.

@Jeremy_Oglesby

1 Solution

Accepted Solutions
ScottWorld
18 - Pluto
18 - Pluto

Welcome to the community, @Embrace_Your_Hustle!

You technically don’t need a nested IF statement, because logical argument #2 will ALWAYS be true if logical argument #1 fails.

So your formula would be pretty simple… it would look like this:

IF(
OR({Date},{Location}="Outside Area"), "Yes", "No"
)

See Solution in Thread

6 Replies 6
ScottWorld
18 - Pluto
18 - Pluto

Welcome to the community, @Embrace_Your_Hustle!

You technically don’t need a nested IF statement, because logical argument #2 will ALWAYS be true if logical argument #1 fails.

So your formula would be pretty simple… it would look like this:

IF(
OR({Date},{Location}="Outside Area"), "Yes", "No"
)

Embrace_Your_Hu
5 - Automation Enthusiast
5 - Automation Enthusiast

Thank you so much @ScottWorld! :clap: :clap: I was completely over complicating it. :grinning_face_with_sweat:

Haha, you’re welcome! :stuck_out_tongue_closed_eyes:

Embrace_Your_Hu
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi @ScottWorld, I got the formula to work in my test table, but had trouble making it work in my production environment. The concept is the same, but the column names are different, which I wouldn’t think would make a difference as long as they are updated. I figured it out though, someone had entered a space after the text in the single select text option. Is there a way to add a wildcard/like operator to the = text area?

IF(
OR({Date},{Location}=“Outside Area”), “Yes”, “No”`
)

Also, is the first part of the logic checking for to confirm whether the Date field is blank?

Thanks again!

Yes, that’s what {Date} on its own is checking for. The existence of data there.

I noticed that this part of your follow-up wasn’t answered. Airtable doesn’t currently support wildcards or other means of pattern matching (i.e. regular expressions). The closest it has are the FIND() and SEARCH() functions, either of which would work in your situation. Here’s the updated formula using FIND():

IF(OR(Date, FIND("Outside Area", Location)), "Yes", "No")

This also adds the ever-so-slight optimization of removing unnecessary curly braces from around the field names. Curly braces are not required for single-word field names, as long as they don’t contain special characters. A field name that’s only numbers, or one that contains spaces or special characters, will require braces around it in your formulas.