I am trying to implement the following code in a calculated column named [Valid] in a document library in modern SharePoint online.

=IF([Valid Until]-TODAY()>=0,"Valid","Expired")

It works fine as long as a document file is uploaded to the library. However, when I upload a folder containing different documents, this does not work and the value displayed in the [Valid] column for the folder is always "Expired". This could be because when I upload a folder the [Valid Until] column does not take any value as input because it is not needed as opposed to a file. How can I solve this issue and display nothing in the [Valid] column when I am uploading a folder?

1 Answer 1


You need to check if "Valid Until" is blank first then check for date. This should work for you =IF(ISBLANK([Valid Until]),"",IF([Valid Until]-TODAY()>=0,"Valid","Expired"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.