# Due Date based on number field (days task should be done before date)

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!

Hi @Brian_Paul1
Can you try this formula?

``````DATEADD('10/1/2022', -{Days Before}, 'days')
``````

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!

``````IF({Days Before} = '', '', DATETIME_FORMAT(DATEADD('10/1/2022', -{Days Before}, 'days'), 'MM/DD/YYYY'))
``````
1 Like

This worked great! Thank you so much. This formula will come in handy for so many things I work on.

1 Like

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'))
``````
1 Like

Yes, use @Kamille_Parks formula instead of mine.