Conditional formatting - Dates < or = or > TODAY(), Icon Set (red, Yellow,Green Light)

sdcc633

New Member
Joined
Sep 2, 2011
Messages
3
For some reason 2007 Excel is not doing this for me. So, can you help?

I have the following table...Reference date = TODAY()
1st Col. 2nd Col. 3rd Col
10/10/1310/23/1310/28/13
11/6/1311/8/13
10/22/1311/11/13
10/22/1311/5/13

<tbody>
</tbody>

I want to compare the 2nd column date with the reference (will change day by day) date and based on 2 things I want excel to do the following:
1. If all 3 columns contain a date, then nothing is put before the date in the second column. Conditional formatting stops
2. No date in the 3rd column, If the date in the 2nd column is > the reference then a red light shows up before the date in the column.
3. No date in the 3rd column, If the date in the 2nd column is = the reference then a yellow light shows up before the date in the column.
4. No date in the 3rd column, If the date in the 2nd column is < the reference then a green light shows up before the date in the column.

I have tried numerous ways but either nothing is happening or screwy results come up.

Suggestions? Thanks!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
If you're willing to try a macro, this should do what you want.
Code:
Sub Test()
    Application.ScreenUpdating = False
    Dim bottomB As Integer
    bottomB = Range("B" & Rows.Count).End(xlUp).Row
    Dim rng As Range
    For Each rng In Range("B2:B" & bottomB)
        If rng.Offset(0, 1) = "" Then
            If rng > Date Then
                rng.Interior.ColorIndex = 3
            ElseIf rng = Date Then
                rng.Interior.ColorIndex = 6
            ElseIf rng < Date Then
                rng.Interior.ColorIndex = 4
            End If
        End If
    Next rng
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
If you're willing to try a macro, this should do what you want.
Code:
Sub Test()
    Application.ScreenUpdating = False
    Dim bottomB As Integer
    bottomB = Range("B" & Rows.Count).End(xlUp).Row
    Dim rng As Range
    For Each rng In Range("B2:B" & bottomB)
        If rng.Offset(0, 1) = "" Then
            If rng > Date Then
                rng.Interior.ColorIndex = 3
            ElseIf rng = Date Then
                rng.Interior.ColorIndex = 6
            ElseIf rng < Date Then
                rng.Interior.ColorIndex = 4
            End If
        End If
    Next rng
    Application.ScreenUpdating = True
End Sub

==============================

mumps,

Thanks! Never did a MACRO but it is always a good time to learn.
 
Upvote 0
Terrific! Did it work for you?
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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