0

I have an expiration date column, and I need to mark the date red yellow green depending on:

if the exp date is within 30 days from today = red if the exp date is within 60 to 90 from today = yellow if the exp date is within 90+ from today = green

I know this basic formula but having a hard time getting much else to work: ="

Any help is appreciated!!

2
  • Which version of SharePoint you are using? Is it classic experience or modern experience? May 18 at 3:27
  • Check my answer given here. This is for both classic UI & modern UI. May 18 at 4:57
0

In SharePoint online, we can use column formatting to customize how fields in SharePoint lists and libraries are displayed.

Simple test for your reference:

@now+2592000000 means adding 30 days to today, @now+5184000000 means adding 60 days to today,@now+7776000000 means adding 90 days to today.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "background-color": "=if(@currentField>=@now&&@currentField<=@now+2592000000,'#FF4633',if(@currentField>=@now+5184000000&&@currentField<=@now+7776000000,'#F6FF33',if(@currentField>@now+7776000000,'#8DFF33','')"
  }
}

Result:

enter image description here

Please note that according to your description, it seems that 30 <expiration <60 is missed, and there will be no color change for the date between this timeline.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.