Forum Discussion
SP Online List Formatting Cell Colour
- 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?
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.
- jonboylibAug 02, 2022Iron Contributor
ganeshsanap Thanks, where do I add this JSON?
Also, I assume I don't have to add this to every row in my list?
- Bharath ArjaAug 02, 2022Iron ContributorYou add the JSON to columns where you want this formatting. Select the drop down next to column -> Column settings -> format this column -> Select Advanced mode -> Paste the JSON ganeshsanap provided. Do this for each column you want to add formatting to.
- jonboylibAug 02, 2022Iron Contributor
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?