+ Reply to Thread
Results 1 to 6 of 6

[Solved] Conditional Formatting based on date and time

  1. #1
    Registered User
    Join Date
    06-08-2011
    Location
    Saskatchewan, Canada
    MS-Off Ver
    Excel 2011
    Posts
    3

    [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.
    Last edited by HackerJL; 06-08-2011 at 06:44 PM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    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. #3
    Registered User
    Join Date
    06-08-2011
    Location
    Saskatchewan, Canada
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: Conditional Formatting based on date and time

    Quote Originally Posted by tigeravatar View Post
    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. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    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. #5
    Registered User
    Join Date
    06-08-2011
    Location
    Saskatchewan, Canada
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: Conditional Formatting based on date and time

    Quote Originally Posted by tigeravatar View Post
    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. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    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.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Bookmarks

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