+ Reply to Thread
Results 1 to 25 of 25

Work out elapsed time with a dynamic clock

  1. #1
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Work out elapsed time with a dynamic clock

    Hello all,

    I'm trying to work out elapsed time in excel using a start time and a dynamic clock. I want any times that exceed 24 hours from the 'In Order' time to turn the cell red. I can get it to work out elapsed time using the following formula =IF(D5 ="","",$J$4-D5) , but when the time is input as 23:00 it returns #####.


    The image below should explain what im trying to achieve:-
    dynamic clock.png

    Any ideas what I can do in this instance? Is the formula i'm using any good?

    Thank you.

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

    Re: Work out elapsed time with a dynamic clock

    Many members are unable to see images in the *.png format due to forum compatibility issues with some browsers.

    If you need to post an image post it in the *.jpg format.

    Even better than posting images... post a SMALL sample file. That way we can test solutions directly in the file with the relevant data.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    Hi Tony, thanks for the advice. Please find a .jpg image below.

    dynamic clock.jpg

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

    Re: Work out elapsed time with a dynamic clock

    What's in J4?

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,911

    Re: Work out elapsed time with a dynamic clock

    Try ...
    =IF(D5="","",MOD($J$4-D5,1))

  6. #6
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    Hi Tony, in J4 is a VBA code that i found on the net.

    Code is as follows:-
    Please Login or Register  to view this content.
    Last edited by zbor; 05-12-2016 at 08:23 AM.

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

    Re: Work out elapsed time with a dynamic clock

    What's the actual cell value?

  8. #8
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    Phuocam, that solution has worked, but now i'm faced with another issue; when it counts past 24 hours elasped time it resets back to 0, I assume i'd need to include the start date into this forumla too?

    I appreciate the help - just to add i'm very new to all of this!

  9. #9
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    Quote Originally Posted by Tony Valko View Post
    What's the actual cell value?
    Tony, i'm not sure I follow. What do you mean by cell value?

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

    Re: Work out elapsed time with a dynamic clock

    Select cell J4.

    What is showing in the formula bar?

  11. #11
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    Nothing other than the current time...

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

    Re: Work out elapsed time with a dynamic clock

    If the value of cell J4 is less than the value of D5 you'll get the cell filled with hash marks.

    By default Excel doesn't recognize negative time.

    The formula suggested by Phuocam should work.
    Last edited by Tony Valko; 05-11-2016 at 08:34 AM.

  13. #13
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    It does indeed, thank you both for your help.

    1 more question - is there a way to get the elapsed time to count past 24, for example 25 hours, so that it does'nt reset to 0 at 23:59:59?

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

    Re: Work out elapsed time with a dynamic clock

    Format the cell as [h]:mm:ss.

    The brackets [ ] keep the time from rolling over into days.

  15. #15
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    Thanks Tony, I've tried your suggestion and formatted the elapsed time cell to [h]:mm:ss, but it still resets to 0 when it counts past 23:59:59, any idea where i'm going wrong?

    Apologies for the additional questions.

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

    Re: Work out elapsed time with a dynamic clock

    Can you post your file so someone can see what's happening?

    I won't download files that contain VBA.

  17. #17
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    Hi Tony, Workbook attached.

    All please note this Workbook contains VBA.

    Many thanks
    Attached Files Attached Files

  18. #18
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Work out elapsed time with a dynamic clock

    Hey er101,

    It works on my machine


    But without the start date how can it know how many days have gone by??

    Try :
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by xladept; 05-11-2016 at 11:51 AM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  19. #19
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24
    Quote Originally Posted by xladept View Post
    Hey er101,

    It works on my machine


    But without the start date how can it know how many days have gone by??
    Ah ok, so I'd need to include the start date, that makes sense.
    I'll be honest, I've no idea how to amend the formula to do that, any suggestions, is it even possible?

    Many thanks.

  20. #20
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Work out elapsed time with a dynamic clock

    Check out my previous post - I've edited it

    But you'll probably want to stop that clock?

  21. #21
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    Hi Xladept, thank you for the help, i've tried your suggested formula above but it still resets to 0.

  22. #22
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    I'm still trying to learn formulas on a subscription website (not sure if i can mention it) but have to admit i'm not fully understanding it!

  23. #23
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Work out elapsed time with a dynamic clock

    Try this:

    Please Login or Register  to view this content.

  24. #24
    Registered User
    Join Date
    10-20-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    24

    Re: Work out elapsed time with a dynamic clock

    Works like a charm, thank you xladept! Now i've got to try and work out how it's done!

  25. #25
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Work out elapsed time with a dynamic clock

    I think the modulo was causing it to reset. Glad to hear it's working! - You're welcome!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Elapsed time, respecting work hours
    By miren324 in forum Excel General
    Replies: 1
    Last Post: 03-24-2015, 05:06 PM
  2. Formula to work out time elapsed based on a UK tax year
    By mhatters in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-19-2015, 08:29 AM
  3. [SOLVED] Elapsed time / clock frustration
    By jaycee66 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-11-2013, 03:12 PM
  4. Default time from 12 hour clock to 24 hour clock
    By MR-77 in forum Excel General
    Replies: 3
    Last Post: 03-31-2011, 04:15 PM
  5. Replies: 3
    Last Post: 09-29-2007, 04:58 PM
  6. Total work hours as if it were a Time Clock
    By vinnievegas in forum Excel General
    Replies: 1
    Last Post: 06-27-2005, 03:05 PM
  7. [SOLVED] how do i work out how many hrs have passed in a 24 hr clock, in ex
    By excelious in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-10-2005, 08:06 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