Quantcast
Channel: SharePoint Legacy Versions - Using SharePoint Designer, InfoPath and Other Customizations Forum
Viewing all articles
Browse latest Browse all 2319

Trying to calculate traffic lights based on two dates

$
0
0

I have a list with two dates (Planned Date and Critical Date) and I am trying to create a calculated field to display the text values Green, Amber and Red based on the comparison between the two dates where:

If Critical Date is more that 14 days after Planned Date, display 'Green'. If Critical Date is between 0 and <= 14 days after Planned Date, display 'Amber'.  If Critical Date is before Planned Date, display 'Red.

I have created the following formula but it displays an error for the Red Option (ie. where the count is negative):

=IF(DATEDIF([Planned Date],[Critical Date],"D")>14,"Green",IF(DATEDIF([Planned Date],[Critical Date],"D")<0,"Red","Amber"))

I searched for, and found a formula to supposedly deal with this, namely:

=IF(ISERROR(DATEDIF([Planned Date],[Critical Date],"D")), -DATEDIF([Planned Date],[Critical Date],"D"))

However I don't know how to merge the two formulas to get my result, or whether there is a simpler way to do it.  Can someone please help?

Thanks


Viewing all articles
Browse latest Browse all 2319

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>