Conditional Formatting with Color Gradient

rscraig11

New Member
Joined
May 3, 2024
Messages
2
Office Version
  1. Prefer Not To Say
Platform
  1. Windows
I'm trying to create a color gradient conditional formatting for scheduling visit windows. So these visits have a target date with a minimum visit window 3 months before the target date and a maximum window date of 7 months after the target date. I'd like to make it so that when the minimum visit window date equals today then the target date turns green and then hits yellow when the target date equals today and goes to red when we hit the maximum visit window. So for example: The target date is 8/3/2024 with the visit window opening today, 5/3/2024, so the target date cell would be green as of today. As we near the target date, it would turn yellow and then as we near 3/2/2025 (the end of the window) it would turn red. Is this possible with Excel?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I don't know how your data are arranged, but something like this? I've shown the minimum and maximum dates for demonstration purposes, but in reality all you need is the target date. Wherever you see reference to A2 in the conditional formatting formulas, replace it with TODAY().


Book1
ABCD
1"Today"Min visit windowTarget dateMax visit window
21/02/20244/02/20244/05/20244/12/2024
34/02/20244/02/20244/05/20244/12/2024
415/03/20244/02/20244/05/20244/12/2024
54/05/20244/02/20244/05/20244/12/2024
615/08/20244/02/20244/05/20244/12/2024
74/12/20244/02/20244/05/20244/12/2024
Sheet1
Cell Formulas
RangeFormula
B2:B7B2=DATE(YEAR(C2),MONTH(C2)-3,DAY(C2))
D2:D7D2=DATE(YEAR(C2),MONTH(C2)+7,DAY(C2))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A7Expression=AND(A2>=DATE(YEAR(C2),MONTH(C2)-3,DAY(C2)),A2<C2)textNO
A2:A7Expression=AND(A2>=C2,A2<DATE(YEAR(C2),MONTH(C2)+7,DAY(C2)))textNO
A2:A7Expression=A2>=DATE(YEAR(C2),MONTH(C2)+7,DAY(C2))textNO
 
Upvote 0
Thank you - is it possible to do this with a gradient on the target date?? so as the window opens it's green, fades to yellow as it nears the target date and then red as we reach the max date?

Data is set up like this:
Min DateTarget DateMax Date
5/6/20248/6/20243/6/2025
2/1/20245/1/202412/1/2024
7/10/202310/10/20235/10/2024

Where just the target date would be changing and the top would be green (min date hit), the middle would be yellow, and the bottom would be red because we're nearing the end of the window. But I'd like it to be a gradient to it fades to red. Then after the max date it goes to black or something and before we hit the min date for the first column it isn't colored.

Thanks!
 
Upvote 0
Apologies I missed the gradient part. What you're after is not exactly possible using colour gradients, but you can get close as long as you don't mind using 90 days and 210 days or thereabouts for 3 months and 7 months respectively.

Here is how to set up the colour gradient.

1715049696218.png


And you require two additional rules to remove the colour at each end of the range.
1715049816682.png



Book1
ABCDE
1Min DateTarget DateMax Date
26/11/20236/02/20246/09/2024
37/11/20237/02/20247/09/2024
421/11/202321/02/202421/09/2024
56/12/20236/03/20246/10/2024
620/12/202320/03/202420/10/2024
73/01/20243/04/20243/11/2024
817/01/202417/04/202417/11/2024
91/02/20241/05/20241/12/2024
10Today ===>7/02/20247/05/20247/12/2024<===
1121/02/202421/05/202421/12/2024
124/03/20244/06/20244/01/2025
1318/03/202418/06/202418/01/2025
142/04/20242/07/20242/02/2025
1516/04/202416/07/202416/02/2025
1630/04/202430/07/20242/03/2025
1713/05/202413/08/202413/03/2025
1827/05/202427/08/202427/03/2025
1910/06/202410/09/202410/04/2025
2024/06/202424/09/202424/04/2025
218/07/20248/10/20248/05/2025
2222/07/202422/10/202422/05/2025
235/08/20245/11/20245/06/2025
2419/08/202419/11/202419/06/2025
253/09/20243/12/20243/07/2025
264/09/20244/12/20244/07/2025
27
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2:C26Expression=$C2<TODAY()-90textYES
C2:C26Expression=$C2>TODAY()+210textYES
C2:C26Other TypeColor scaleNO
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,147
Members
453,021
Latest member
Justyna P

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