Airtable Cobuilder is here! Learn more about our new no-code app creation feature, powered by AI on the Airtable Academy

# Re: Formula Inside Switch ()

Solved
Jump to Solution
956 1
cancel
Showing results for
Search instead for
Did you mean:
5 - Automation Enthusiast

Hi there! I’m an Airtable noob, but a spreadsheet lover.

I’m trying to create a formula (Switch looked like the best), that will create custom dates based on the “Task Name.” It involves date math based on “Original Publish Date” field which is a date.

Here is a rough example of what I’m trying:
SWITCH(
{Task Name},
“Create Illustration”, DATEADD({Original Publish Date},-14,‘days’),
“Generate blog post and schedule post”, DATEADD({Original Publish Date},-13,‘days’),
“Create snippets for social media”, DATEADD({Original Publish Date},-12,‘days’),
)

I’ve tried paranthesis around dateadd and end before the comma. That didn’t work either.

Is this possible? I see other formulas that seem to work.

1 Solution

Accepted Solutions
18 - Pluto

You have an extra comma at the end of that last long line.

Also, make sure that you’re only using straight quotes instead of curly quotes throughout your formula. Airtable will choke on all curly quotes.

4 Replies 4
18 - Pluto

You have an extra comma at the end of that last long line.

Also, make sure that you’re only using straight quotes instead of curly quotes throughout your formula. Airtable will choke on all curly quotes.

5 - Automation Enthusiast

Doh! That was the culprit. Both the comma and the curly quotes. One other thing I’m seeing is that the results includes the time. The starting field is just MM/DD/YYYY and the formula is MM/DD/YYYY HH:MM:SS. I can’t see a way of formatting that?

18 - Pluto

There should be a formatting tab to click on, where you can turn off the time.

5 - Automation Enthusiast

ha! It’s hiding inside the customize field type. I was looking for it outside. Thanks!!