0

can you please help me evaluate what is wrong with the if statement below, i need to use it in a SharePoint 2013 calculated column, but I keep getting an error.

  =if([Today]-[Last Reviewed Month/Year]<=180,"Green"
        ,if(and([Today]-[Last Reviewed Month/Year]>180,[Today]-[Last Reviewed Month/Year]<365),"Yellow"
           , if([Today] -[Last Reviewed Month/Year])>365,"Red")))
T Zhang
  • 195
  • 3
  • 17
  • You are having a dead bracket in the end of the calculation. – Christoffer Jun 21 '17 at 07:59
  • Thanks, I changed the formula as below: =if([Today]-[Last Reviewed Month/Year]<=180,"Green" ,if(and([Today]-[Last Reviewed Month/Year]>180,[Today]-[Last Reviewed Month/Year]<365),"Yellow" , if([Today]-[Last Reviewed Month/Year]>365,"Red"))) , but when i saved the page, i got a runtime error instead – T Zhang Jun 21 '17 at 08:03

2 Answers2

0

1) A calculated column can only use the fields that are given by the GUI. The today keyword must then be referencing to an existing column. I do not think you want to do this, perhaps there is your problem.

2) Depending on the installation/language of your SharePoint environment the parameter seperator must be change from comma "," to semicolumn ";"?

bonm014
  • 66
  • 6
  • Hi Bonm014, yes, "Today" is an existing column, and i need to calculate the date difference between [today] and[Last Reviewed Month/Year] ... probably i should use the " datediff" function ... – T Zhang Jun 21 '17 at 08:10
0

Common mistake

Today has restrictions in a Formula:

How to use Today and Me in Calculated column

Your use case will only work if you have a Workflow that updates your custom [Today] fied

Danny '365CSI' Engelman
  • 21,176
  • 7
  • 35
  • 79