I want a formula to display:

  1. red color when the due date is either today or in the past
  2. amber color when the due date is in the next 5 days
  3. green color when the due date is either after 5 days or the date field is empty/blank

I write the following formula but it does not work properly:

IF(CGT_Due_Date__c > TODAY()+5, IMAGE("/img/samples/color_green.gif", "green", 30, 30),
IF( ISBLANK(CGT_Due_Date__c) , IMAGE("/img/samples/color_green.gif", "green", 30, 30),
IF(CGT_Due_Date__c  =  TODAY() +1  &&  CGT_Due_Date__c < TODAY() +5, IMAGE("/img/samples/color_yellow.gif", "yellow", 30, 30),
IMAGE("/img/samples/color_red.gif", "red", 30, 30)
) ))
  • "does not work properly": what is it doing right now? Aug 11 '21 at 12:08
  • Hello, and welcome to SFSE. Please take a moment to read How to Ask and take the tour. Please edit your post to describe in detail what parts of your formula are not working, and include any errors that occur. Aug 11 '21 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.