Conditional Formatting Help

Occasional Visitor

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/normal background colour

then 1-2 days from due date = orange

then day of due date = red


Also another Due date column for another item

e.g. day of due date = red

then 1-2 days from due date = orange

then 3-7 days from due date = normal/background colour


Thank you!

2 Replies
best response confirmed by Tedster (Occasional Visitor)

@Tedster you can do this by formatting the Due column with the following JSON. Note that dates are calculated in milliseconds.

    "$schema": "",
    "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"




Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)