Forum Discussion
jonboylib
Aug 02, 2022Iron Contributor
SP Online List Formatting Cell Colour
I have a simple list that contains column months and totals. See below: If any cell is greater than £0 I would like to change the background colour of that cell to red. How can I ach...
- Aug 02, 2022
Bharath Arja Thanks.
So, it's not possible to apply this styling to a complete list? If I have 50 columns I need to do this 50 times, manually?
ganeshsanap
Aug 02, 2022MVP
jonboylib Try using below JSON, it should work for number columns:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"background-color": "=if(@currentField > 0, 'red', '')",
"color": "white"
},
"txtContent": "@currentField"
}
This JSON adds background color of cell as red. You can change the style as per your requirements.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.