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?
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,343
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,343

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,343
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
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,585
Messages
5,512,232
Members
408,885
Latest member
binduchekuri

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top