Conditional formatting based on multiple number range E.g =>50 and =>75

Viewed 63

I have a column in a ShP list where I need whatever figure we enter to change colour according to the range they fit in: red for <= 50, amber for =>51 and green for >75

I have it working for two ranges but I am still trying to figure out the format into which I should write a range of numbers between >51 and <74 but I have yet to find the format to write it down.

Here's what I have working so far:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "attributes": {
    "class": "=if(@currentField <= 50,'sp-field-severity--blocked', if(@currentField >75,'sp-field-severity--good','')"
  },
  "children": [
    {
      "elmType": "span",
      "style": {
        "display": "inline-block",
        "padding": "0 4px"
      },
      "attributes": {
        "iconName": "=if(@currentField <= 50,'SadSolid', if(@currentField >75,'Emoji2', '')"
      }
    },
    {
      "elmType": "span",
      "txtContent": "@currentField"
    }
  ]
}

Can anyone see what I'm missing? I can't be far off... I have managed to fit in a second condition today and it works. Last one to go.

0 Answers
Related