Conditional formatting sharepoint calendar column with another calendar column

D, Sujith 0 Reputation points
2023-07-27T19:01:53.8+00:00

i have multiple columns of dates. Below is snap of my sharepoint page.

1.Tool design plan & tool design actual

2.Tool manufacture plan & tool manufacture actual

3.Supplier inspection plan & supplier inspection actual.

I need conditional formatting these columns

if "tool design actual" is equal to or less than "tool design plan" date, then "tool design actual" column should be in green colour, or else red colour,

similarly if "tool manufacture actual" is is equal to or less than "Tool manufacture plan", then "tool manufacture actual" column should be in green colour, or else red colour,

Note: there is an option to format the column only wrt to today or for a particular date, but its not comparing dates of 2 column, pls help me.

User's image

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

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 51,946 Reputation points Microsoft External Staff
    2023-07-28T09:42:29.86+00:00

    Here are steps:

    1.Click "Tool design actual" column -> Column settings -> Format this column -> Advanced mode.

    2.Using following codes.

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "div",
      "debugMode": true,
      "txtContent": "@currentField",
      "style": {
        "color": "=if([$Tooldesignactual] <= [$Tooldesignplan], 'green', 'red')"
      }
    }
    

    3.Click "Tool manufacture actual" column -> Column settings -> Format this column -> Advanced mode.

    4.Using following codes.

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "div",
      "debugMode": true,
      "txtContent": "@currentField",
      "style": {
        "color": "=if([$Toolmanufactureactual] <= [$Toolmanufactureplan], 'green', 'red')"
      }
    }
    

    Result:

    enter image description here


    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.


Your answer

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