Consulting

Results 1 to 7 of 7

Thread: calculating time difference

  1. #1
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location

    calculating time difference

    What is the formula to give the difference in minutes in the following cells. The formula I have includes the hours which is inconsequential for my result. I just need the minutes between the time.

    HTML Code:
      11/6/2017  10:38  11/6/2017 18:57  8:19
    Peace of mind is found in some of the strangest places.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Excel's Date/Time are in Days and fractions of Days

    So subtracting the two dates gives you the difference in (fraction of) days and multiplying by 24 * 60 converts days to minutes


    Capture.JPG
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Paul,

    So if you calculate it by hand the real difference between 10:38 and 18:57 in minutes minus the 8 hours is 19 minutes. Not quite following the formula and how you get 499. However if you subtract 480 from it (60 minutes in and hour *8 I get 20). Looks =like its rounding up.


    =24*60*(D7-C7)-480
    Peace of mind is found in some of the strangest places.

  4. #4
    VBAX Expert
    Joined
    May 2016
    Posts
    604
    Location
    =MINUTE(B1)-MINUTE(A1)

    Then format the result as a number instead of time

  5. #5
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    thanks off. that got exactly what i wanted.
    Peace of mind is found in some of the strangest places.

  6. #6
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    What is the formula to give the difference in minutes in the following cells.
    I misunderstood - I thought you wanted the difference in minutes, not the difference in THE minutes

    But at least you got your answer


    BTW, will that work if the start time is 12:50 and the end is 14:10?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  7. #7
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    thanks Paul. no i dont believe it will but for these purposes i just need to know the difference in punch in and out times. However it might come into play if the individual forgets to punch out or in.
    Peace of mind is found in some of the strangest places.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •