Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This has been the MOST helpful forum that I have been a part of and I want to say thank you. The tips, tricks and helpful advice that you all contribute to have been lifesavers in many instances..."

Geography

Where in the world do Tek-Tips members come from?

Excel 2010 Conditional Formatting - Color based on different datesHelpful Member! 

BlueHorizon (Instructor)
30 Apr 12 18:57
Good day all!

I'm working with a date entered in cell A1.  Here's what I need to have happen:

As soon as a date is entered in A1, B1 turns green to show its status.

At 9 months from the date in A1, I need B1 to turn yellow.

At 1 year plus 1 day in A1, I need B1 to turn red.

Do-able?  Appreciate any help at all!
 

Best,
Blue Horizon 2thumbsup
 

Andrzejek (Programmer)
30 Apr 12 20:49
   
That doesn't make any sense.
I enter in A1 a date of 5/5/2057, B1 turns green?
I enter in A1 a date of 1/1/1647, B1 turns green?

"At 9 months from the date in A1" 9 months before or after the date in A1

Have fun.

---- Andy

BlueHorizon (Instructor)
1 May 12 6:13
Here's my goal:

In A1, I enter 5/1/2012, cell B1 turns green.

In 9 months FROM the date entered in A1, when today's date is 2/1/2013, cell B1 turns yellow.

In 366 days, when today's date is 5/2/2013, cell B1 turns red.

Can you help?

Best,
Blue Horizon 2thumbsup
 

Helpful Member!  dhulbert (TechnicalUser)
1 May 12 6:29

I'm using 2007 but it shouldn't be much different on 2010

You can format a call based on a formula so if you use

=TODAY()-$C$4 < 30 as the formula then it will format the cell as Green for dates < 30 days

then add a second rule using

=TODAY()-$C$4 < 270

for your 9 months etc.

Works fine for me.
  

I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
 

Andrzejek (Programmer)
1 May 12 8:46
    
That should get you started:
  

CODE --> in Sheet1

Option Explicit
  
Private Sub Worksheet_Activate()
  
If Range("A1").Value <> "" Then
    If IsDate(Range("A1").Value) Then
        If (Date - Range("A1").Value) < 30 Then
            Range("B1").Interior.Color = vbGreen
        End If
    Else
        MsgBox "Cell A1 is not a Date"
    End If
Else
    MsgBox "Cell A1 is empty"
End If
  
End Sub
  
But I am sure dhulbert's approach will work, too.

Have fun.

---- Andy

SkipVought (Programmer)
1 May 12 8:49


Andy,

Why would you even THINK about using code for a CF?????

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

BlueHorizon (Instructor)
1 May 12 10:06
How would you do it, Skip, using CF?  smile

Best,
Blue Horizon 2thumbsup
 

SkipVought (Programmer)
1 May 12 10:18


as dhulbert posited, using multiple CF conditions.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Andrzejek (Programmer)
1 May 12 10:55
   
Skip, I wasn't thinking.  Sorry.  sad
   
But... now BlueHorizon knows there is more than one way to 'skin the cat' (why anybody would want to 'skin the cat'...? smile )

Have fun.

---- Andy

BlueHorizon (Instructor)
1 May 12 11:40
Thank you all for taking the time to help!  I'll try these and let you know....

Have a good week,
Best,
Kathy

Best,
Blue Horizon 2thumbsup
 

BlueHorizon (Instructor)
1 May 12 19:39
A variation of dhulbert's solution worked great! A star for you!

Have a good week all,
Kathy

Best,
Blue Horizon 2thumbsup
 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close