Help

Remove NaN in a countdown date field

Topic Labels: Formulas
Solved
Jump to Solution
2057 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Kathryna_Hancoc
4 - Data Explorer
4 - Data Explorer

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?

1 Solution

Accepted Solutions
Jason
Airtable Employee
Airtable Employee

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-the...

See Solution in Thread

3 Replies 3
Jason
Airtable Employee
Airtable Employee

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-the...

Kathryna_Hancoc
4 - Data Explorer
4 - Data Explorer

Thank you! That worked!

You’re welcome @Kathryna_Hancock!