+ Reply to Thread
Results 1 to 9 of 9

Conditional Formatting with Times

  1. #1
    Registered User
    Join Date
    04-23-2012
    Location
    Davie, FL
    MS-Off Ver
    Excel 2013
    Posts
    83

    Conditional Formatting with Times

    I'm trying to do a conditional formatting that will highlight any times past 5:00 PM.. I tried this but it didn’t work: =IF(a:a<"5:01:00 PM")

    See attached. can someone help please?

    Thank you,
    Trish

    Book1.xlsx

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Conditional Formatting with Times

    =IF(a:a<"5:01:00 PM")

    this is how to turn text into a time value
    =TIMEVALUE("5:01 PM")
    this extracts the time from the date/time cell
    =TIME(HOUR(A2),MINUTE(A2),SECOND(A2))

    so you can use , in a conditional format
    =TIME(HOUR(A2),MINUTE(A2),SECOND(A2))<TIMEVALUE("5:01 PM")

    see attached
    Attached Files Attached Files
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    04-23-2012
    Location
    Davie, FL
    MS-Off Ver
    Excel 2013
    Posts
    83

    Re: Conditional Formatting with Times

    Actually the value on A4 should've been the highlighted one not the other 2 because they are before 5pm.

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Conditional Formatting with Times

    =IF(a:a<"5:01:00 PM")
    is showing A less than for TRUE

    but all you need to do is change the < to >

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional Formatting with Times

    Quote Originally Posted by trosasco View Post
    I'm trying to do a conditional formatting that will highlight any times past 5:00 PM.. I tried this but it didn’t work: =IF(a:a<"5:01:00 PM")
    You say you want to highlight if the time is PAST 5:00 PM but your formula is trying to test times BEFORE 5:01 PM.

    In your file the cells also contain a date so you need to account for that.

    Try this formula:

    =MOD(A2,1)>TIME(17,0,0)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Registered User
    Join Date
    04-23-2012
    Location
    Davie, FL
    MS-Off Ver
    Excel 2013
    Posts
    83

    Re: Conditional Formatting with Times

    You are both right. I always get this < and > confused. I made the change but I'm still having trouble figuring this out. See attached. This is the original report. Notice that D17, D25 and D39 are not supposed to be highlighted but the ones I highlighted in yellow are. How is this happening? Please help.

    Trish

    Expenses Spreadsheet.xlsx

  7. #7
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Conditional Formatting with Times

    your selecting the whole of the column
    D:D
    and You have the formula as D2
    so its one row out

    also you dont put the range in the formula

    SO if you change the range in the formula
    from D2:??
    TO
    Just
    D1
    it will work

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional Formatting with Times

    Try it like this...

    Select the *entire* range D2:D84 starting from cell D2.
    Cell D2 will be the active cell. The active cell is the
    one cell in the selected range that is not shaded. The
    formula will be relative to the active cell.

    Goto the Home tab>Conditional Formatting>
    Manage rules>New rule>Use a formula to determine
    which cells to format

    Enter this formula in the box below:

    =MOD(D2,1)>TIME(17,0,0)

    Click the Format button
    Select the Fill tab
    Select the desired fill color
    OK out

  9. #9
    Registered User
    Join Date
    04-23-2012
    Location
    Davie, FL
    MS-Off Ver
    Excel 2013
    Posts
    83

    Re: Conditional Formatting with Times

    Yes thank you for noticing that. I did that part all kinds of ways.. Finally got it to work. Thank you. This thread is closed.. Phew!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Conditional formatting for times
    By kcreme in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-10-2013, 12:01 AM
  2. Conditional Formatting with times
    By frankiebrooke in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-25-2012, 07:07 PM
  3. [SOLVED] Conditional Formatting Times (hh:mm)
    By lanos in forum Excel General
    Replies: 15
    Last Post: 07-19-2012, 10:24 AM
  4. [SOLVED] Excel 2007 : Conditional formatting for times
    By sushil10s in forum Excel General
    Replies: 1
    Last Post: 02-22-2012, 10:56 AM
  5. conditional formatting using IF with times
    By zman36 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2011, 05:17 AM

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