0

New to this, real Noob.

I have a SP list column named rating, based on the value I need to change the cell color.

  • Value 1 to 3 - Green.
  • Value 4 to 6 - Yellow.
  • Value 8 to 12 - Orange.
  • Value 15 to 25 - Red.

Would someone please be able to help with the code/syntax. Really appreciate the assistance, out of my depth.

1 Answer 1

0

Try JSON below and modify as needed. In your condition, you have not mentioned the color for the value outside the condition, that is, else condition. I used "gray", but you can change it to your liking.

You can visit MS site for more JSON formatting examples.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "background-color": "=if(@currentField >=1 && @currentField <=3, 'Green', if(@currentField >=4 && @currentField <=6, 'Yellow', if(@currentField >=8 && @currentField <=12, 'Orange', if(@currentField >=15 && @currentField <=25, 'Red', 'gray'))))",
    "color": "black",
    "font-size": "2.0em",
    "justify-content": "center"
  }
}

enter image description here

1
  • Hi Matiur, Thank you!!!!! That is perfect, exactly what I was after. Really appreciate the help. Commented Oct 4, 2020 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.