Jun 15, 2022 12:09 PM
Hi everyone.
I am trying to calculate a due date based on a specific date minus number of days before.
Example:
The master Date of a trip is 10/01/2022.
I have a column (DAYS BEFORE TRIP) where I enter the number of days that a specific task needs to be done before the trip. I have another Column (DUE DATE) that lists the due date based on that calculation. I need a formula that basically does this…
10/01/2022 - (DAYS BEFORE TRIP) = Due Date
So let’s say I need to book airfare 30 days before the trip. In the DAYS BEFORE TRIP field I would enter 30. My formula with then would calculate and display 09/01/2022 as the due date.
There are so many tasks that I don’t want to have the trip date listed every time so I want to embed the actual date in the formula. I hope this makes sense. Thanks for your help!
Jun 15, 2022 12:27 PM
Hi @Brian_Paul1
Can you try this formula?
DATEADD('10/1/2022', -{Days Before}, 'days')
Jun 15, 2022 12:36 PM
This seems to be working, but for some reason it’s adding a due date to fields where there is no input yet. Any thoughts or ideas? Thank you!
Jun 15, 2022 12:47 PM
IF({Days Before} = '', '', DATETIME_FORMAT(DATEADD('10/1/2022', -{Days Before}, 'days'), 'MM/DD/YYYY'))
Jun 16, 2022 07:29 AM
This worked great! Thank you so much. This formula will come in handy for so many things I work on.
Jun 16, 2022 08:58 AM
If you want usable dates then use a formula that doesn’t force an output as a string.
IF({Days Before}, DATEADD('10/1/2022', -{Days Before}, 'days'))
Jun 16, 2022 09:07 AM
Yes, use @Kamille_Parks formula instead of mine.