Help

Multiple ifs in a single record

Topic Labels: Formulas
Solved
Jump to Solution
700 3
cancel
Showing results for 
Search instead for 
Did you mean: 
ssanto88
5 - Automation Enthusiast
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.

ssanto88_0-1688408217285.png

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
pressGO_design
10 - Mercury
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.

See Solution in Thread

3 Replies 3
pressGO_design
10 - Mercury
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.

Sho
11 - Venus
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.

That worked great, thanks! I'll definitely take your advice on those linking those records too 👍