Forum Discussion
Gristy
Dec 08, 2020Brass Contributor
Column Formatting Help
Hello, I am trying to get some column formatting working but struggling. All i basically want is Today = Yellow Background, Tomorrow = Blue Background, everything else unformatted. Obviously the...
SteveKnutson
Dec 09, 2020MVP
Gristy I am a little short on time, but this might help. The code below formats the item background red if the date is less than 30 days from now otherwise it leaves the background white.
Hope this helps 🙂
{
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if(@currentField >= @now + 2592000000 || @currentField <= @now - 62208000000,'white', '#ffa59b')"
}
}
- GristyDec 09, 2020Brass ContributorHi Steve
Thank you but that is not what is required
Today is yellow and tomorrow is blue
Everything else no formatting
Cheers
Chris- RobElliottDec 09, 2020Silver Contributor
Gristy you can do it with the following JSON:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField", "style": { "background-color": "=if(@currentField == Date(@now,toDateString()),'#f4b846', if(@currentField > @now && @currentField <= (@now + 86400000),'#80c1c5','white')" } }which gives this result:
Rob
Los Gallardos
Microsoft Power Automate Community Super User- GristyDec 09, 2020Brass Contributorthank you so much you have made this look a lot easier !