Monthly schedule - conditional formatting date range that exists in one cell

DushiPunda

Well-known Member
Joined
Nov 14, 2015
Messages
518
Office Version
  1. 2021
Platform
  1. Windows
Greetings,
I have a monthly schedule spreadsheet that I'd like to add some conditional formatting to based on a date range that would exist in one cell.

Example:
B42 = 8/18/24-8/22/24
Conditional formatting applied to C3:AG4

Expected result: Highlight the given dates on my sheet (in this case it would highlight T3:X4).

If necessary, I'm open to having a couple cells outside of the print area if I need to use a formula to split the range into two different cells.

I was able to do this split by doing:
Excel Formula:
=LEFT(B42,FIND("-",B42&"-")-1)
Excel Formula:
=RIGHT(B42,FIND("-",B42&"-")-1)

Now just need to concoct a conditional formatting formula that looks at those dates and highlights the necessary cells.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Just played around a little with this.
1.
Excel Formula:
=RIGHT(B42,FIND("-",B42&"-")-1)
changed to
Excel Formula:
=RIGHT(B42,FIND("-",B42&"-")+1)
Note for later: the LEFT formula is in cell B45 and the RIGHT formula is in B46
2. I tried the following conditional formatting formulas:
Excel Formula:
=AND(DATEVALUE(C$3)>=DATEVALUE($B$45),DATEVALUE(C$3)<=DATEVALUE($B$46))
Excel Formula:
=AND(C$3>=$B$45,C$3<=$B$46)

Neither of these worked.

I decided to check if excel was reading my dates as actual dates, but I encountered the following:
Excel Formula:
=DATEVALUE(B45)(
Return: 45522
Excel Formula:
=DATEVALUE(B46)
Return: 45526
Excel Formula:
=DATEVALUE(T3)
Return: #VALUE!

T3 contents: "8/18/2024" formatted with a custom to only show the day (d). So it appears that excel isn't reading T3 as a date?

🤔

Edited to add:
This doesn't appear to be affecting any of my other conditional formatting based on dates. For example, I have a holidays section (B39 & B40). For example, Independence Day is in cell B39 on my July sheet. My conditional formatting is:
Excel Formula:
=OR(C$3=$B$39,C$3=$B$40)

Applied to the same range mentioned in the first post:
C3:AG4
 
Last edited:
Upvote 0
Try this:
Select the range C3:AG4
Conditional formatting->New Rule->Use a formula->In the formula bar add this formula:
=AND(C4>=DATEVALUE(LEFT($B$42,FIND("-",$B$42)-1)),C4<=DATEVALUE(MID($B$42,FIND("-",$B$42)+1,99))). Set the formatting how you want and then OK out.
 
Upvote 0
Solution

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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