Remove NaN in a countdown date field

Hi There! I have a series of tasks with deadlines. The field next to “Deadline” is a countdown titled "Days Left’ with the amount of days left until the task is due. However, I don’t yet have/need deadlines for some of the tasks, so the Deadline field is sometimes empty which results in NaN.

The formula I used for “Days Left” is DATETIME_DIFF(Deadline, TODAY(), ‘days’)

I’ve tried a few different IF formulas to remove NaN but I keep getting errors. Can anyone help me out here?

Welcome to the community @Kathryna_Hancock!

You can use an IF statement to only run your existing formula if there is a date in the Deadline field. Here’s how that should look:

IF(Deadline, DATETIME_DIFF(Deadline, NOW(), 'days')) 

Notice that I also switched out TODAY() with NOW() because NOW() uses the exact current day and time, while TODAY() defaults to the current day at 12:00am.

You can also find more tips on troubleshooting common formula errors like NaN here: https://support.airtable.com/hc/en-us/articles/360034619694-Common-formula-errors-and-how-to-fix-them

1 Like

Thank you! That worked!

You’re welcome @Kathryna_Hancock!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.