Help

Re: Future Date Formula

Solved
Jump to Solution
863 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Cameron_Mason
4 - Data Explorer
4 - Data Explorer

I’m trying to use a formula field to calculate a date for benefits eligibility like health insurance. For example, if an employee starts on August 6th, 2020 we require them to wait until the first of the month following their first 90 days of employment until they are eligible.

With the DATEADD formula, I can add 90 days, but I’m not sure how to take the result from 90 days to the first of the following month.

With the example above the result I’m looking for would be December 1st, 2020.

1 Solution

Accepted Solutions
Justin_Barrett
18 - Pluto
18 - Pluto

Welcome to the community, @Cameron_Mason! :grinning_face_with_big_eyes: You’ve got a good start with DATEADD(). Now it’s just a matter of adding other pieces to it. To get the next month after that 90-day window, add one month to the result of your initial calculation:

DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months")

Using your example starting date, that will put the date somewhere in December. To get the actual month as a number, wrap the MONTH() function around it:

MONTH(DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months"))

That returns the number 12. Doing something similar with the YEAR() function to grab the year, and adding “/1/” in the middle of the two, we can build a string that represents the first date of that month:

MONTH(DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months")) & "/1/" & YEAR(DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months"))

That will give us the string “12/1/2020” in this example. Now wrap the DATETIME_PARSE() function around all of it, and you have an actual date:

DATETIME_PARSE(MONTH(DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months")) & "/1/" & YEAR(DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months")), "M/D/YYYY")

Screen Shot 2020-08-27 at 9.24.15 AM

I left the time option active for the field formatting, but you can obviously turn that off if you wish.

See Solution in Thread

2 Replies 2
Justin_Barrett
18 - Pluto
18 - Pluto

Welcome to the community, @Cameron_Mason! :grinning_face_with_big_eyes: You’ve got a good start with DATEADD(). Now it’s just a matter of adding other pieces to it. To get the next month after that 90-day window, add one month to the result of your initial calculation:

DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months")

Using your example starting date, that will put the date somewhere in December. To get the actual month as a number, wrap the MONTH() function around it:

MONTH(DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months"))

That returns the number 12. Doing something similar with the YEAR() function to grab the year, and adding “/1/” in the middle of the two, we can build a string that represents the first date of that month:

MONTH(DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months")) & "/1/" & YEAR(DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months"))

That will give us the string “12/1/2020” in this example. Now wrap the DATETIME_PARSE() function around all of it, and you have an actual date:

DATETIME_PARSE(MONTH(DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months")) & "/1/" & YEAR(DATEADD(DATEADD({Start Date}, 90, "days"), 1, "months")), "M/D/YYYY")

Screen Shot 2020-08-27 at 9.24.15 AM

I left the time option active for the field formatting, but you can obviously turn that off if you wish.

Thank you Justin! This was super helpful. I use Airtable mainly for linking data and tracking progress, most of my modeling and formulas are done in Google Sheets.

I was obviously having trouble figuring this out in Airtable.