Multiple ifs in a single record

Topic Labels: Formulas
Solved
700 3
cancel
Showing results for
Did you mean:
5 - Automation Enthusiast

Hi there, thanks for taking the time to read my question! New to Airtable and it's formulas - what I'm trying to do is create a simple Hours of Operation setup where a user can select the days of the week a business is open (stored in Open Days), add the open hours for each day, then combine the values to show the complete hours of operation (combined in Hours of Operation field). I'm starting with just Monday and Tuesday and I don't seem to be able to put two IF formulas within the same record. Only the Monday IF/FIND formula works and not the Tuesday. If I delete the Monday portion and leave the Tuesday, then the Tuesday portion works. That's what makes me think that you can only have a single IF formula (as well as nested IFs) and not more than one. I included screenshots and my formulas. If there's a better way of doing this I'm definitely open to that.

Formula in "Hours of Operation" field:

IF(
FIND("Monday",{Open Days},0)=1,"Monday "&{M-Start}&" - "&{M-End},
"Monday - Closed")&
"\n"&
IF(
FIND("Tuesday",{Open Days},0)=1,"Tuesday "&{T-Start}&" - "&{T-End},
"Tuesday - Closed")

1 Solution

Accepted Solutions
10 - Mercury

Airtable doesn't need to spell things out as explicitly as Excel does, so the formula should be

IF(
FIND("Monday",{Open Days}),"Monday "&{M-Start}&" - "&{M-End},
"Monday - Closed")&
"\n"&
IF(
FIND("Tuesday",{Open Days}),"Tuesday "&{T-Start}&" - "&{T-End},
"Tuesday - Closed")

Am editing this comment to suggest that you consider what you're trying to achieve with this. If you're playing around and using formulas, then totes yay, but if you're going to use this as part of a larger system or process it might be better to have the days be linked records with lookups to get the Hours of Operations.

3 Replies 3
10 - Mercury

Airtable doesn't need to spell things out as explicitly as Excel does, so the formula should be

IF(
FIND("Monday",{Open Days}),"Monday "&{M-Start}&" - "&{M-End},
"Monday - Closed")&
"\n"&
IF(
FIND("Tuesday",{Open Days}),"Tuesday "&{T-Start}&" - "&{T-End},
"Tuesday - Closed")

Am editing this comment to suggest that you consider what you're trying to achieve with this. If you're playing around and using formulas, then totes yay, but if you're going to use this as part of a larger system or process it might be better to have the days be linked records with lookups to get the Hours of Operations.

11 - Venus

The FIND() function returns the position of the search character

FIND("Tuesday",{Open Days},0)=1

is incorrect.
">=" 1 or by not adding an evaluation expression like @pressGO_design  (true except for 0 or false or null), it will work correctly.

5 - Automation Enthusiast