Calculated columns cannot contain volatile functions like Today and Me
-
15-02-2021 - |
题
I am working on a custom list inside a SharePoint online site collection. and i have a custom column named "Last Update" of type DateTime, and i want to create a calculated column to show the differences between today and the "Last Update" site column.
So i created a new site column of type Calculated column, with the following formula:-
and it worked well, but when i tried to add this column inside our list, i got this error:-
any advice?
解决方案
Use below formula to calculate the difference between Today and Last Update Date column.
=IF(ISBLANK([Last Update]),"",(TEXT(NOW(),"mm/dd/yyyy")-[Last Update]))
and set The data type returned from this formula to : Number
in order to get difference in Number of days between two dates.
其他提示
We simply cannot use [Today] or [Me] in calculated columns. Use formulas like
=DATEVALUE(TEXT(NOW(),"mm/dd/yyyy")) - DATEVALUE(TEXT([Created],"mm/dd/yyyy"))
or =TEXT(NOW(),"mm/dd/yyyy")-[Created]
will be workarounds you can use. And remember if you use DateValue function, you need to set the The data type returned from this formula is:
to be date.