Forum Discussion
andreaskelly
Oct 12, 2021Copper Contributor
SharePoint Online List - Format column based on a date range
Hello community, I want to change the background color of a date column in my SharePoint Online list based on the date that has been written in the field. My goal is the following: If date i...
lcdelgado
Dec 08, 2022Copper Contributor
Thanks 🙂
lcdelgado
Dec 15, 2022Copper Contributor
I have this code: {
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if(@currentField <= @now + 1296000000, 'red', (if(@currentField >= @now + 1296000000 && @currentField <= @now + 2592000000,'orange', ''))",
"color": "=if(@currentField <= @now + 2592000000, 'white', 'black')",
"padding-left": "10px"
}
}
Can you help me here?
I need that the expiration field = TODAY then red, 15 days before will be yellow, instead red and 30 days yellow as well. thanks
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if(@currentField <= @now + 1296000000, 'red', (if(@currentField >= @now + 1296000000 && @currentField <= @now + 2592000000,'orange', ''))",
"color": "=if(@currentField <= @now + 2592000000, 'white', 'black')",
"padding-left": "10px"
}
}
Can you help me here?
I need that the expiration field = TODAY then red, 15 days before will be yellow, instead red and 30 days yellow as well. thanks