Home > Back-end >  How do I change the background color of a cell depending on the date in Google Sheets?
How do I change the background color of a cell depending on the date in Google Sheets?

Time:01-08

I created a little calendar in Google Sheets:

https://i.imgur.com/nOgTOgL.png

In the first row, I would like the cell above today's date to change its background color to black (while all the other ones stay white). How can that be achieved?

I looked at other similar threads such as this one - How can i change text depending on the date in another cell Spreadsheets - but none of them seem to target this exact issue.

I also set conditional formatting: Format cells if > Date is > Today (formatting style: change background color), but it did not format the cell no matter whether it was empty, or whether it included today's date.

CodePudding user response:

Select the cells (B1 to AF1) where you want the color to change, (set color to the black you desire). set the formatting rule from the drop down to be "custom formula is" use this formula to check if the value in B3 is indeed = today. This assumes you get the dates in row 3 by formatting a real date.

=B$3=TODAY()

Heres a demo https://docs.google.com/spreadsheets/d/1sgenCtQ3-kTVsD_eJy55PymRXdkGpgAGkaaOA2sLBGM/edit#gid=0

Cheers Mads

  • Related