Apr 07, 2020 07:39 AM
Hi everybody,
I’m struggling to find the right code for my formula.
I’m making a content calender in airtable. I made a text field “text input” and I made an attachement field “image”. My goal is to have a field that tells me the status of the content. What I’m looking for is a formula that kinda goes like this:
IF {text input} is empty then: “ :bell: write text”
IF {image} is empty then: “ :bell: upload image”
IF {text input} and {image} are empty then: " :bell: :bell: write text, upload image"
IF {text input} and {image} are not empty then: " :white_check_mark: Ready to go"
Can anybody help me how to get the right formula?
Also… (to make things interesting) I was wondering if there’s a way to add a “deadline” feature to the same formula. My question is: is it be possible to add something like this too:
IF {text input} or {image} is empty, and {deadline} is within 2 days, then “ :rotating_light: HURRY”
Hopefully someone can help me out with this.
Thank you guys so much for your time and efforts!
Solved! Go to Solution.
Apr 09, 2020 08:38 AM
IF(
AND(
DATETIME_DIFF({deadline},Today(), 'days') < 2,
{status} != " :white_check_mark: Ready to go"
),
“:rotating_light: Hurry”,
“:+1: on schedule”
)
Apr 08, 2020 08:02 AM
Haven’t tested it so there could be errors, but you basically need to nest IF blocks. The indented version is just for readability. Run the minified one below it to debug.
Indented for Readability
IF(
AND({text input},{image}),
":white_check_mark: Ready to go",
IF(
{text input},
“:bell: upload image”},
IF(
{image}),
":bell: :bell: write text",
IF( DATETIME_DIFF({deadline},Today(), 'days') < 2,
“:rotating_light: HURRY”,
" :bell: :bell: write text, upload image"
)
)
)
)
Minified
IF(AND({text input},{image})," :white_check_mark: Ready to go",IF({text input},“ :bell: upload image”},IF({image})," :bell: :bell: write text",IF( DATETIME_DIFF({deadline},Today(), ‘days’) < 2,“ :rotating_light: HURRY”," :bell: :bell: write text, upload image"))))
Apr 09, 2020 02:44 AM
Thank you Zollie,
With your input I was able to make it work. Unfortunatly I also realised that adding the {deadline} field into the formula actually didn’t improve the “clear overview” I had in mind… Instead I think it’s better to separate them and make an additional field that goes like this:
If {deadline} is within 2 days, and status is not " :white_check_mark: Ready to go" Then “ :rotating_light: Hurry” , “ :thumbs_up: on scedule”
I tried using your previous reply as an example but for some reason it doesn’t recognise the difference between days. Could this be because the {deadline} field is also a formula field instead of an actual date field? It shouldn’t be tho… I made a calender view based on the same {deadline} field… So it should recognise it…
Any ideas?
Apr 09, 2020 08:38 AM
IF(
AND(
DATETIME_DIFF({deadline},Today(), 'days') < 2,
{status} != " :white_check_mark: Ready to go"
),
“:rotating_light: Hurry”,
“:+1: on schedule”
)
Apr 10, 2020 07:47 AM
You’re the best!
I tried to copy the formula directly. Unfortunatly that didn’t work… When I tried it manually, it did the job.
Very nice!