Forum Discussion

TanyaMc's avatar
TanyaMc
Copper Contributor
Apr 04, 2021
Solved

List conditional formatting with multiple conditions and column references

I used the interface to create the first condition on each column to highlight required information, logic for which is the following:   If Expired = Y, then Expired Explanation turns orange (r...
  • RobElliott's avatar
    Apr 05, 2021

    TanyaMc yes you can do this and the result is shown below:

     

     

    For the Explanation column the JSON  that you need to paste into the Advanced mode window is as follows:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "padding-left": "14px",
        "background-color": "=if(@currentField == '' && [$Expired] == 'Y', '#ff7e00', if(@currentField != '' ,'#85b18e', '#cacfd6')",
        "color": "white"
      }
    }

     

    For the Comments column the JSON is:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "padding-left": "14px",
        "background-color": "=if(@currentField != '', '#85b18e', if(([$Explanation] == 'Other (provide comments)' || ([$Explanation] == 'Renewed'),'#ff7e00', '#cacfd6' )",
        "color": "white"
      }
    }

     

    Hope that helps.

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User.
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

     

Resources