JSoN Conditional Formatting to highlight a Row as red if it is beyond 3 days and to not put any highlight if within 3 days

Treb Bert 60 Reputation points
2024-04-30T08:44:03.55+00:00

Hi,

I need help to use JSON conditional format to highlight a particular date as red if it is already beyond 3 days from the current date. For example, date in that particular row is 4/30/2024 and it will be highlighted as red when May 3 comes(so on and so forth), will be highlighted as red. Also, it should exclude weekends in the process. Row name is Process Date.

And to not have any highlight once date is closed in time or within 2 days. The closed date column is in a different column

Thank you so much for helping. I'm having a hard time finding solutions online.

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

Accepted answer
  1. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2024-05-01T09:26:36.69+00:00

    Hi @Treb Bert ,

    Thank you for posting in this community.

    First create a calculated column(named CALweekday in my case) to calculate the 3-day expiration date excluding weekends.

    =IF(WEEKDAY([Process Date])=2,[Process Date]+3,(IF(WEEKDAY([Process Date])=3,[Process Date]+3,(IF(WEEKDAY([Process Date])=1,[Process Date]+3+1,[Process Date]+3+2)))))
    

    User's image

    User's image

    Then use the following JSoN Conditional Formatting code:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
      "additionalRowClass": "=if([$ClosedDate],if([$ClosedDate] >= [$CALweekday],'sp-field-severity--severeWarning',''),if([$CALweekday] <= @now,'sp-field-severity--severeWarning','')) || if(([$ClosedDate] >= [$CALweekday]), 'sp-field-severity--severeWarning', '')"
    }
    

    Output:

    User's image


    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.

    1 person found this answer helpful.

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.