0

I want to express this condition with my formula taking into consideration the date of 02/29

  • End date >= Current date + 365 then green
  • End date between Today's date + 1 and Today's date + 364 then orange
  • End date <= Today's date then red
IF( AND (TODAY() <DATE(YEAR(End_Date__c)-1,MONTH(End_Date__c),DAY(End_Date__c))),
IMAGE($Setup.CORE_Static_Resource_URL__c.CORE_Relative_URL_Path__c &"/Icons/Green.png","Green",16,16),
IF(
AND(
TODAY() >DATE(
YEAR(End_Date__c)-1,
MONTH(End_Date__c),
DAY(End_Date__c)
) ,

TODAY() < End_Date__c
),
IMAGE($Setup.CORE_Static_Resource_URL__c.CORE_Relative_URL_Path__c &"/Icons/Orange.png","Orange",16,16 ),IMAGE($Setup.CORE_Static_Resource_URL__c.CORE_Relative_URL_Path__c &"/Icons/Red.png","Red",16,16 )))

1 Answer 1

0

You can just add/subtract a number from TDOAY() to adjust a date by a number of days:

IF(End_Date__c>=TODAY()+365,
  IMAGE($Setup.CORE_Static_Resource_URL__c.CORE_Relative_URL_Path__c &"/Icons/Green.png","Green",16,16),
  IF(End_Date__c>TODAY(),
    IMAGE($Setup.CORE_Static_Resource_URL__c.CORE_Relative_URL_Path__c &"/Icons/Orange.png","Orange",16,16 ),
     IMAGE($Setup.CORE_Static_Resource_URL__c.CORE_Relative_URL_Path__c &"/Icons/Red.png","Red",16,16 )
  )
)

This automatically takes care of leap years.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .