Formula Inside Switch ()

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.

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.

1 Like

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?

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

1 Like

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

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.