Color-Coding SharePoint Online

Wissam 61 Reputation points
2022-09-14T00:20:48.633+00:00

Hello Guys, I need help setting up a color-coding-by-time situation in SharePoint Online

I have a column with date and time for example 2022-09-14 01:02 a:m
I need to make a condition on same column that the color change as followed

If less than 15 min light-Green
If over 15 min light-orange
If over 30 min light-Red

you help is much appreciated

Microsoft 365 and Office SharePoint For business Windows
{count} votes

Accepted answer
  1. Jing Sun_MSFT 956 Reputation points
    2022-09-14T08:40:22.187+00:00

    Hi @Wissam ,
    Per your description, you could have a try on the JSON code below

    {  
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",  
      "elmType": "div",  
      "txtContent": "@currentField",  
      "style": {  
        "background-color": "=if(Number(@currentField) == 0, '',if(@now<= @currentField+ 900000, 'lightgreen', if(@now > @currentField + 900000 && @now <= @currentField + 1800000, '#fed8b1', if(@now > @currentField + 1800000, '#ff3333', ''))))"  
      }  
    }  
    

    Test result:
    241227-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.