+ Reply to Thread
Results 1 to 10 of 10

Difference between two times

  1. #1
    Registered User
    Join Date
    05-24-2011
    Location
    somerset, nj
    MS-Off Ver
    Excel 2007
    Posts
    5

    Difference between two times

    Hi Experts

    I have Time in the following format SAT Mar 05 22:32 EST 2011

    I need find the difference between the current time NOW() and the above time

    I need to get the output in <Days> <Hours> <Minutes>


    Can any one suggest me a formula for this?

    Thank You for your time and help
    Last edited by NBVC; 05-24-2011 at 03:11 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Difference between two times

    To get the correct numeric answer, the formula would be:

    =NOW()-(DATEVALUE(MID(A1,5,6)&", "&RIGHT(A1,4))+TIMEVALUE(MID(A1,FIND(":",A1)-3,5)))

    Then format that cell with a custom number format of: d" days, "h" hours, "mm" minutes"
    Last edited by JBeaucaire; 05-24-2011 at 01:06 PM.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    05-24-2011
    Location
    somerset, nj
    MS-Off Ver
    Excel 2007
    Posts
    5

    Difference between two times

    Hi Experts

    I have Time in the following format SAT Mar 05 22:32 EST 2011

    I need find the difference between the current time NOW() and the above time

    I need to get the output in <Days> <Hours> <Minutes>


    Can any one suggest me a formula for this?

    Thank You for your time and help

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Difference between two times

    Does this work?

    Assuming original is in A1:

    Please Login or Register  to view this content.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  5. #5
    Registered User
    Join Date
    05-24-2011
    Location
    somerset, nj
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Difference between two times

    Thanks so much for taking the time .

    The time difference I get is 19 days, 14 hours, 48 minutes, but that is not the correct value when we calculate the difference between Now() and Sat Mar 05 22:32 EST 2011

    thanks

  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: Difference between two times

    Well, this is far uglier...

    =INT(TODAY()-(DATEVALUE(MID(A1,5,6))))-1 & " days," & TEXT(MOD(NOW()-TIMEVALUE(MID(A1,FIND(":",A1)-3,5)), 1), "h") & " hours, " & TEXT(MOD(NOW()-TIMEVALUE(MID(A1,FIND(":",A1)-3,5)), 1), "m") & " minutes"
    Attached Files Attached Files

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Difference between two times

    Please do not duplicate posts.

    This time I merged them, next time might be an infraction.
    Last edited by NBVC; 05-24-2011 at 01:10 PM.

  8. #8
    Registered User
    Join Date
    05-24-2011
    Location
    somerset, nj
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Difference between two times

    Hello NBVC

    Thanks for your response, I did not see this earlier. Yes the formula works perfectly.


    I had added this post originally in the Excel General Discussions, then I added it to this Excel Programming as I felt this forum would be more appropriate for the nature of my post.

    Thanks once again for your time.

  9. #9
    Registered User
    Join Date
    05-24-2011
    Location
    somerset, nj
    MS-Off Ver
    Excel 2007
    Posts
    5

    Thumbs up Re: Difference between two times

    Thanks everyone for taking the time .

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Difference between two times

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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