Forum Discussion

Walterwhamil72's avatar
Walterwhamil72
Copper Contributor
Feb 25, 2021

Conditional formatting

I'd like to apply conditional formatting to an auto calculated column that needs to display the value as a %.  I'd like to highlight values >= 75% and <90% as yellow and values >=90% as red.  I'm unfamiliar with JSON and am unable to get the syntax correct.  I can get it to highlight the cells correctly but it displays the values as a decimal number and not a %.

4 Replies

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    Walterwhamil72 this can be done as follows. In your calculated column use the following formula:

     

     

     The formatting of the column is then like this:

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "=[$Percent]*100 + '%'",
      "style": {
        "color": "=if([$Percent] >= 0.75 , '#ffffff', '#525252'",
        "background-color": "= if(([$Percent] >= 0.75 && [$Percent] < 0.90 , '#eebf2d', if(([$Percent] > 0.90, '#730000'), '#ffffff'"
      }
    }

     

    which gives the following result:

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User

    • Walterwhamil72's avatar
      Walterwhamil72
      Copper Contributor

      RobElliott Thanks for the guidance.  I followed your instructions but the column is now blank.  The column names I need in the calculation are:

       

      Cumulative Invoiced/Total Value

       

      The formula I'm using looks like this:

       

       My JSON looks like this:

       The Burn Rate column looks like this now:

       Walt.

      • RobElliott's avatar
        RobElliott
        Silver Contributor

        Walterwhamil72 the reason it's not working is that in your JSON you've used my column which is called Percent. You've got to use your burn rate column name - as you've got a space in the name check what SharePoint has called it internally in List settings, select the column and check what is after field= in the address bar.

         

        Rob
        Los Gallardos
        Microsoft Power Automate Community Super User

Resources