+ Reply to Thread
Results 1 to 8 of 8

Conditional format - Time format that passes 3hrs?

  1. #1
    Registered User
    Join Date
    04-01-2020
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    3

    Conditional format - Time format that passes 3hrs?

    Hi everyone,
    I need a formula for conditional formatting the highlights once 3hrs have passed from a single time cell? So time is in A1 for example, 11:00am. Once its 14:01 it highlights red.

    Many thanks in advance. Hope thats ok?

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Conditional format - Time format that passes 3hrs?

    You could use a custom rule of:

    =(MOD(NOW(),1)-A1)>3/24

    and format as red

    note however, a volatile action will be required to trigger a calculation in order for the rule to be evaluated.

  3. #3
    Valued Forum Contributor
    Join Date
    06-22-2018
    Location
    Blackpool, England
    MS-Off Ver
    2019
    Posts
    408

    Re: Conditional format - Time format that passes 3hrs?

    If A2 contains a date with the time, B2 would show the "due" time with the formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Put this in C2
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and do a conditional format.

    That should fix it.

    HTH
    Tim


    EDIT: Forgot to add that it's a volatile function, but I now see XLent got there first!
    Last edited by harrisonland; 04-01-2020 at 09:31 AM.
    Never stop learning!
    <--- please consider *-ing !

  4. #4
    Registered User
    Join Date
    04-01-2020
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Conditional format - Time format that passes 3hrs?

    Thanks for your help, but what is a volatile function?

  5. #5
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Conditional format - Time format that passes 3hrs?

    the calc engine is clever to the point that it will only calculate what it needs to when it needs to thanks to it's calculation tree (known precedents etc) but there are exceptions with Volatile functions being the prime example.
    another exception is if, within the VB Editor, you enforce full calculation thereby overriding the above - this can be helpful if you have RAM issues on an otherwise efficient file

    a Volatile function will recalculate whenever the calculation engine is triggered c/o a Volatile action - like entering a value in a cell, hiding a row etc
    always worth remembering that not every action is volatile - e.g. formatting a cell, or hiding a column

    generally speaking Volatile functions are detrimental to performance as they generate additional calculation overhead
    as always, odd exception, e.g. Data Validation -- using a Volatile in a Data Validaton rule generates no additional overhead as only evaluated when the Data Validation is invoked

    the key here, in your example, is that the Conditional Format will work, logically speaking, but will only be enacted if a calculation is triggered

    to illustrate concept, I could say enter the below Volatile function into A1:

    =RANDBETWEEN(1,1000)

    however, once I've committed the above it won't change again until I perform a volatile action that triggers the calc engine -- like typing "a" into B1
    (the above is what we mean by additional overhead as technically speaking A1 has no direct dependency on B1 yet it still recalculates when B1 is modified)

    so, what I was trying to say was, you can add the Conditional Format rule as outlined - but unless you're doing something that triggers a calculation in XL it won't be evaluated

    so you could watch the cell all day and it would never change colour, regardless of the time, but if you type "a" into another cell it would.

    the best resource, IMO, for all things Volatility is Charles Williams' website, the author of many a white paper etc.

    http://www.decisionmodels.com/calcsecrets.htm
    Last edited by XLent; 04-01-2020 at 10:30 AM.

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Conditional format - Time format that passes 3hrs?


  7. #7
    Valued Forum Contributor
    Join Date
    06-22-2018
    Location
    Blackpool, England
    MS-Off Ver
    2019
    Posts
    408

    Re: Conditional format - Time format that passes 3hrs?

    "Volatile" means it depends on a value that constantly changes - for instance the current time or today's date. A calculated cell value that is "volatile" can't always be relied on to be correct unless the workbook has just re-calculated.

    NB: XLent's solution, above, will work whether your single cell (A1) is a date/time stamp, or just contains the time. Mine will only work if (A2) includes the date as well.

    I assumed that would be the case as as you could otherwise get false results. Consider, for example, if your single "Time" cell contained the time "11:34pm".

    Tim

  8. #8
    Registered User
    Join Date
    04-01-2020
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Conditional format - Time format that passes 3hrs?

    Thank you everyone, thats really helpful.

+ 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. Replies: 12
    Last Post: 02-19-2018, 12:32 PM
  2. [SOLVED] 3hrs 32min format to 3:32 format
    By bdenzer in forum Excel General
    Replies: 3
    Last Post: 07-27-2015, 06:02 PM
  3. Conditional format time
    By airhoodz in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-04-2015, 10:36 PM
  4. Replies: 3
    Last Post: 02-24-2015, 02:58 AM
  5. [SOLVED] Conditional formatting for [h]:mm time format
    By mialupini in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-16-2015, 06:02 PM
  6. [SOLVED] time conditional format in d3 not working
    By jpbisani in forum Excel General
    Replies: 3
    Last Post: 01-01-2015, 11:04 AM
  7. Conditional Time Format
    By khansolo in forum Excel General
    Replies: 10
    Last Post: 07-09-2012, 09:39 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