3 Color Scale with Dates

Newbienew

Active Member
Joined
Mar 17, 2017
Messages
408
Office Version
  1. 2016
Platform
  1. Windows
Good Day Pros,

I wanted to know if there is a formula that allows you to highlight red, yellow, and Green in a gradient scheme but with dates. So if the beginning date is 1 jan 2025 and today's date is in between the 1st and the 15th it will be green. If today's date is over 15 days but less than 30 days is yellow and if its over 31 days its red. Is there a way to do this?
 
Last edited:
XL2bb can't copy gradient scheme so do it manualy

Cell Formulas
RangeFormula
A3:G8A3=IFERROR(DAY(TEXT(DATE(2025,1,1),"yyyy-mm-")&TRANSPOSE(ROW(1:7)+1)+(ROW($1:$6)-1)*7-WEEKDAY(DATE(2025,1,1))),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:G8Expression=AND(A3<>"",A3>30)textNO
A3:G8Expression=AND(A3>15,A3<30)textNO
A3:G8Expression=A3<16textNO
 
Upvote 0
Excel Formula:
Sub Three_Color_Scale_with_Dates()
    
    
    With Range("A3:G8") '<<<<<
    .FormatConditions.Delete
        .FormatConditions.Add Type:=xlExpression, Formula1:="=A3<16"
        .FormatConditions(.FormatConditions.Count).SetFirstPriority
        With .FormatConditions(1).Interior
            .Pattern = xlPatternLinearGradient
            .Gradient.Degree = 90
            .Gradient.ColorStops.Clear
        End With
        With .FormatConditions(1).Interior.Gradient.ColorStops
        .Add(0).Color = 16711422
        .Add(0.5).Color = 5222144
        .Add(1).Color = 16711422
        End With
        .FormatConditions(1).StopIfTrue = False
        .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(A3>15,A3<30)"
        .FormatConditions(.FormatConditions.Count).SetFirstPriority
        With .FormatConditions(1).Interior
            .Pattern = xlPatternLinearGradient
            .Gradient.Degree = 90
            .Gradient.ColorStops.Clear
        End With
        With .FormatConditions(1).Interior.Gradient.ColorStops
            .Add(0).Color = 16711422
            .Add(0.5).Color = 65278
            .Add(1).Color = 16711422
        End With
        .FormatConditions(1).StopIfTrue = False
        .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(A3<>"""",A3>30)"
        .FormatConditions(.FormatConditions.Count).SetFirstPriority
        With .FormatConditions(1).Interior
            .Pattern = xlPatternLinearGradient
            .Gradient.Degree = 90
            .Gradient.ColorStops.Clear
        End With
        With .FormatConditions(1).Interior.Gradient.ColorStops
            .Add(0).Color = 16711422
            .Add(0.5).Color = 254
            .Add(1).Color = 16711422
        End With
        .FormatConditions(1).StopIfTrue = False
    
    End With
End Sub
 
Upvote 0
I do apologize for the late response and feedback. I would love to use VBA, but most of my projects bounce between google sheets and Teams. The formula would need to work with the NOW() or Today() formula. So it would change automatically as the days go on.
 
Upvote 0

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