Apr 09, 2018 11:50 AM
Hello. I have a table with the days of the week:
Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
I have a following column with “Schedule”
If I have something in Sunday, Monday, and Tuesday, how can I get the “Schedule” column to automatically list “Sunday, Monday, Tuesday”?
I can do this in Excel accessing the name of the column, but, how do I do this in AirTable?
Apr 09, 2018 11:59 AM
One thing I thought about was a formula to do it.
“IF(Sunday, “Sunday”, “”),IF(Monday, “Monday”, “”)”
But I don’t know how to get multiple IF statements.
Apr 09, 2018 12:42 PM
You’re on the right track. In this case, though, you probably don’t want a nested IF()
statement but you want to concatenate several IF()
statements:
IF(Sunday,'Sunday')&
IF(Monday,'Monday')&
IF(Tuesday,'Tuesday')&
IF(Wednesday,'Wednesday')&
IF(Thursday,'Thursday')&
IF(Friday,'Friday')&
IF(Saturday,'Saturday')
That’s almost it, but that would give you, for instance
SundayTuesdayWednesdayFriday
So we’ll first place a space after each day name; then we’ll trim off any trailing spaces; and finally we’ll replace the remaining, between-day spaces with a comma-space pair, like so:
SUBSTITUTE(
TRIM(
IF(Sunday,'Sunday ')&
IF(Monday,'Monday ')&
IF(Tuesday,'Tuesday ')&
IF(Wednesday,'Wednesday ')&
IF(Thursday,'Thursday ')&
IF(Friday,'Friday ')&
IF(Saturday,'Saturday')
),
' ',
', '
)
Now you’ll get
Sunday, Tuesday, Wednesday, Friday
or the like.
Apr 09, 2018 04:14 PM
Thank you! That is brilliant! & modifier! I learned something new today!