简体   繁体   中英

Is there a formula to change the colour of a cell, based on todays date?

I have a spreadsheet in Google Docs which has a new column for each day, the header being the date it was filled out.

I want to to set the background colour as grey for every column which has a header/date that comes before today.

(Note: the cells I want to set the background colour for do not contain a date. It's only the header of the column)

Is this possible?

Not sure if this is applicable as i do not use Google Docs but it works in excel.

Left column                  right column

Tuesday, July 24, 2012       =IF(B1<B3,1,0)
Wednesday, July 25, 2012     =IF(B2<B3,1,0)
Thursday, July 26, 2012      =IF(B3<B3,1,0)

Result:

Left column                  right column

Tuesday, July 24, 2012       1
Wednesday, July 25, 2012     1
Thursday, July 26, 2012      0

Now apply conditional formatting based on the value of the right column.

It does not matter if cells contain the date. The date is only necessary for a condition evaluation. The code that will conditionally format the background can easily operate on range of cells.

The new Google Sheets can do some of this. Follow the instructions here: https://support.google.com/drive/answer/78413?hl=en

Although it does not solve completely the question, you will be able to define one columns color based on a cell's value.

Hope it helped.

Ps: While I was testing it I have encountered some bugs in this feature so it may very well happen that it won't be really useful. We'll see...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM