SharePoint Calculated Column Blanks & Negative numbers

New Contributor

Hello - I have a calculated column that calculates the amount of days until the due date. My formula is:

=DATEDIF(TODAY(),[Contract Expiration Date],"D")

How can I revise this formula so I don't get an error value when the Expiration Date is blank or if days until due is a negative number?


2 Replies
best response confirmed by analysta (New Contributor)
I figured out the correct formula. Here it is in case anyone else needs it.

=IF(ISBLANK([Contract Expiration Date]),"",IF(ISERROR(DATEDIF(TODAY(),[Contract Expiration Date],"d")),-DATEDIF([Contract Expiration Date],TODAY(),"d"),DATEDIF(TODAY(),[Contract Expiration Date],"d")))

@analysta Or something like this might also work for you: 


=IF(ISBLANK([Contract Expiration Date]),"",IF(TODAY()>=[Contract Expiration Date],DATEDIF([Contract Expiration Date],TODAY(),"d"),DATEDIF(TODAY(),[Contract Expiration Date],"d")))


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs