Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Add months and subtract days

Solved
Jump to Solution
4091 2
cancel
Showing results for 
Search instead for 
Did you mean: 
James_McHugh
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi, just started using Airtable and I think it’s great. I was wondering if it’s possible to use the DATEADD() function to add a set number of months and subtract a set number of days in the same formula. I realise I could create two fields, one with DATEADD() for the months and a second with DATEADD() to subtract the days but just wondering if there’s a more elegant solution?

Any help would be appreciated.

Thanks

1 Solution

Accepted Solutions
AlliAlosa
10 - Mercury
10 - Mercury

Hi there, James! Welcome to the community!

You can absolutely do this. Let’s say we want to add one month, and subtract one day. I would write the formula like this:

IF({Date}, DATEADD(DATEADD({Date}, 1, 'month'), -1, 'day'))

If {Date} were today, 11/17/2019, the above would give us a result of 12/16/2019.

You could write this without wrapping it in the IF() statement, but I recommend using it to avoid getting #ERROR! when the field {Date} is empty :slightly_smiling_face:

See Solution in Thread

2 Replies 2
AlliAlosa
10 - Mercury
10 - Mercury

Hi there, James! Welcome to the community!

You can absolutely do this. Let’s say we want to add one month, and subtract one day. I would write the formula like this:

IF({Date}, DATEADD(DATEADD({Date}, 1, 'month'), -1, 'day'))

If {Date} were today, 11/17/2019, the above would give us a result of 12/16/2019.

You could write this without wrapping it in the IF() statement, but I recommend using it to avoid getting #ERROR! when the field {Date} is empty :slightly_smiling_face:

That’s great, thanks!