# Re: Add months and subtract days

Solved
1252 1
cancel
Showing results for
Did you mean:
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
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:

2 Replies 2
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:

5 - Automation Enthusiast

That’s great, thanks!