# [Solved] Conditional Formatting based on date and time

1. ## [Solved] Conditional Formatting based on date and time

I have 4 columns:

A is expected time, b is expected date, c is actual time, d is actual date.

I want conditional formatting to highlight the item in C if its after A's time, but on B's date. Anything earlier is good as gold. But in this case an AND statement doesnt work, and neither does an OR. Can someone shed some light on this? I am pulling out my hair

thanks....a long time lurker of the forums.

2. ## Re: Conditional Formatting based on date and time

HackerJL,

Welcome to the forum.

Attached is a sample workbook of what I envision you described. Column C has the following formula for its conditional format rule:
=AND(\$C1>\$A1,\$D1>=\$B1)

Hope that helps,
~tigeravatar

3. ## Re: Conditional Formatting based on date and time

Originally Posted by tigeravatar
HackerJL,

Welcome to the forum.

Attached is a sample workbook of what I envision you described. Column C has the following formula for its conditional format rule:
=AND(\$C1>\$A1,\$D1>=\$B1)

Hope that helps,
~tigeravatar
Exactly as I have it. But change D3 to May 2, 2011, and C3 to 7AM - still late, but doesnt highlight because 7am is less than 8 am. See my predicament?

4. ## Re: Conditional Formatting based on date and time

HackerJL,

Ah, ok. I see the problem, give this a try for the conditional formatting rule on column C:
=OR(\$D1-\$B1>0,AND(\$D1-\$B1=0,\$C1>\$A1))

Hope that helps,
~tigeravatar

5. ## Re: Conditional Formatting based on date and time

Originally Posted by tigeravatar
HackerJL,

Ah, ok. I see the problem, give this a try for the conditional formatting rule on column C:
=OR(\$D1-\$B1>0,AND(\$D1-\$B1=0,\$C1>\$A1))

Hope that helps,
~tigeravatar
FANTASTIC. Thanks a ton!

6. ## Re: [Solved] Conditional Formatting based on date and time

The CF formula that works for me is:

=AND(COUNT(A1:D1)=4, A1+B1<C1+D1)

This only triggers if all 4 values are entered.

EDIT: Sorry, late to the party. Hat-tip to tiger.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1