Change cell color based on date

mrkris1982

Active Member
Joined
Apr 16, 2009
Messages
407
Wondering how I could code the cell to change to a different color for 5 different scenariois:

Blank (no color) if no text is in the cell
Bright Green if text is in the cell for 0-24 hours (restart time if new text is added to existing text)
Yellow if text has been unchanged for 24-48 hours
Rose if text has been unchanged for 72 hours
Red if text has been unchanged for 96 hours

Any ideas?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,855
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
Platform
  1. Windows
ideas - yes but first U must decide how you will track when a cell value is changed.
you probably need some vba Worksheet_Change events.
suggestion - create a hidden sheet with name corresponding to the one in question.
when the event Worksheet_Change appears record the event time in the hidden sheet in the location of the changed cell.
then a bit of conditional formatting shoul do the rest.
P.S.: you have 4 required conditions - Excel prior 2007 supports only 3.
 

doofusboy

Well-known Member
Joined
Oct 14, 2003
Messages
1,325
Are you using Excel2007 and have you looked into conditional formatting?
 

mrkris1982

Active Member
Joined
Apr 16, 2009
Messages
407
I am using Office 2003. I know I can use CF, but only three options.

I could make it only 3 conditions (<24 hrs, <36 hours & >36 hours) but I do not have any idea how to code this formula in CF
 

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,855
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
Platform
  1. Windows

ADVERTISEMENT

if you know when the cell is changed and you call this moment TimeChanged then:
(<24 hours): now()-TimeChanged<1
(<36 hours): 1<=now()-TimeChanged<1.5
(>36 hours): now()-TimeChanged=>1.5

 

mrkris1982

Active Member
Joined
Apr 16, 2009
Messages
407
Cool;

So I just need to go to CF, choose FORMULA IS and paste your formulas below, correct?
 

mrkris1982

Active Member
Joined
Apr 16, 2009
Messages
407
There must be something more to it than just puttin it in CF because I tried it, then enterred text and the cell did not change colors.
 

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,855
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
Platform
  1. Windows
not exactly - first you must decide how you will assign a value to TimeChanged
and this value will be different for each cell - it must be automatically recorded somewhere on each change - some vba must be written - but i don't have time right now
maybe later or tomorrow
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,575
Messages
5,832,576
Members
430,142
Latest member
ivonsurf123

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
Top