Calculated field column
-
21-02-2021 - |
Вопрос
I am trying to compare two date columns in SharePoint. I need to update the created date field to a different date, but only on documents that have a scan date less than the created date. So I have a formula in a date update column thatstates =IF([Scan Date]<[Created],"Yes"), but when I apply it, it says that all of the documents have a scan date less than the created date. So I thought ok, that is not working, I will change it to say if the dates are equal to say “No” and the formula I have is =IF([Scan Date]=Created,"NO","YES") and the results are all “No”. So the formula only half works. What am I doing wrong? Any help would be greatly appreciated!
Решение
The following worked for me, where [Scan Date] is Date and Time Column, [Created] is a System column shows when items are created and [ScanStatus] Calculated column outputs Single line of text
Does it match your conditions?
=IF([Scan Date]<Created,"Yes","No")
Updated the formula
to show date comparisons:
If column Date and Time format is Date Only then [Date1]=[Date2]
If the format is Date and Time use as shown below:
=IF(DATE(YEAR([Scan Date]),MONTH([Scan Date]),DAY([Scan Date]))=DATE(YEAR(Created),MONTH(Created),DAY(Created)),"Yes","No")