# Conditional Formatting a date/time comparison

The function I'm working on specifically compares & colors a daily recurring time range set in 2 different cells. A specific date in the target cells (produced by a formula) compare to that daily time range and color coordinate if it falls within that range or not.

Ive broken it down into steps like my math teachers taught me years ago. Step 1) First off, I know I must change the date/time format to just a time. Since the time range is already in a single days' time format.

My Daily Variables

[A2] Cell TimeStart : `12:00 PM` ## (.5)

[B2] Cell TimeEnd : `1:30 PM` ## (.5625)

[D9] RAW Date/Time : `12/31/99 12:15 PM` ##(Calculated)

[D10] Modified for Comparison: `=D9-INT(D9)` ## 12:15 (.510416666)

[E10] Duplicate for tests `=D9-INT(D9)` ## 12:15 (.510416666)

Conditional Wizard works (D10)

``````Cell Value is:
Between: "\$A\$2" and: "\$B\$2"
Cell Style: "Untitled1"
``````

Conditional Formula (E10)

``````=D9-INT(D9)+STYLE(AND(CURRENT()>A2;CURRENT()<B2);"Untitled1";"Default")
``````

also tried

``````=D9-INT(D9)+STYLE(AND(CURRENT()>\$A\$2;CURRENT()<\$B\$2);"Untitled1";"Default")
``````

returns

``````#Value
``````

Other entries tried in Cell. And, then removing "D9-INT(D9)" in the Conditional Formatting Wizard:

``````=D9-INT(D9)+STYLE(AND((CURRENT()-INT(CURRENT())>\$A\$2;(CURRENT()-INT(CURRENT())<\$B\$2);"Untitled1";"Default")))
``````

AutoCorrects to:

``````=D9-INT(D9)+STYLE(AND((CURRENT()-INT(CURRENT())>\$A\$2~(CURRENT()-INT(CURRENT())<\$B\$2)~"Untitled1"~"Default")))
``````

and still error 502

So, 2 questions:

1. How can I incorporate the STYLE within the formula? The help file says that's the format.

2. Can I not do it all in 1 cell (D9)? (My eventual goal - to condense)

-