Forum Discussion
Tedster
Jun 06, 2022Copper Contributor
Conditional Formatting Help
Hi everyone, Hoping to get help with the following: I would like to set a Dude Date column to change the colour based on how many days to the due date e.g. 3-5 days from due date = white/...
- Jun 07, 2022
Tedster you can do this by formatting the Due column with the following JSON. Note that dates are calculated in milliseconds.
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField", "style": { "background-color": "=if(@currentField <=@now, '#c00000', if(@currentField > @now && @currentField <= @now + 172800000, 'orange', 'white'))", "color": "=if(@currentField <=@now+172800000, 'white','#363636')", "padding-left": "5px" } }Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
RobElliott
Jun 07, 2022Silver Contributor
Tedster you can do this by formatting the Due column with the following JSON. Note that dates are calculated in milliseconds.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if(@currentField <=@now, '#c00000', if(@currentField > @now && @currentField <= @now + 172800000, 'orange', 'white'))",
"color": "=if(@currentField <=@now+172800000, 'white','#363636')",
"padding-left": "5px"
}
}
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)