Conditional formatting based upon today, along with days before and after. (Google Sheets)

mtaylor

Board Regular
Joined
May 1, 2013
Messages
78
Office Version
  1. Prefer Not To Say
Platform
  1. Windows
  2. MacOS
Hi, thanks for looking.

I have a spreadsheet which is used to record covid results in a school. I have a formula entered which calculates the 'valid until' date, which would be +14 days from test date (=IF(ISBLANK(E3),"",E3+14).

What I would like is that cell (F3:F58 in this case to:

Turn green if the date is not within 2 days of today
Turn orange if the date within 2 days of today (including today
Turn red if the date is past today.

I currently have this:

1614055476239.png


Which I believe works ok for the red but the others.

The empty cells (of which there is no date, currently also turn green, I'd prefer if they remain colourless.)

Again, thanks for looking.

Am in Google Sheets trying to smash this out.
 
Last edited by a moderator:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi, Use below:
For RED:
=AND($F3 < TODAY(),NOT(ISBLANK($F3)))

For ORANGE:
=AND($F3 >= TODAY(),$F3 <= TODAY()+2)

For GREEN
=$F3 > TODAY()+2
 

Attachments

  • conditionalFormatting.JPG
    conditionalFormatting.JPG
    101.2 KB · Views: 6
Upvote 0
Solution
Hi, Use below:
For RED:
=AND($F3 < TODAY(),NOT(ISBLANK($F3)))

For ORANGE:
=AND($F3 >= TODAY(),$F3 <= TODAY()+2)

For GREEN
=$F3 > TODAY()+2
Love it - thanks a bunch

Can I ask about the blank cells, so for those that don't have a date in the E column, I don't want the F column cell equivalent to turn green.

Again, the main issue has been solved, this now is for aesthetic reasons.

Thanks again
 
Upvote 0
Hi, to handle blank I used code while showing RED cell. We can use same in GREEN if required.

=AND($E3 > TODAY()+2, NOT(ISBLANK($E3)))
 
Upvote 0

Forum statistics

Threads
1,224,028
Messages
6,175,993
Members
452,694
Latest member
SaruwatariKaito

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top