Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Calculating time between 2 entries

  1. #1
    New Member
    Join Date
    Mar 2002
    Location
    Fairfax, Virginia
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a column that has a date/time format of dd/mm/yy hhmm. I need to calculate the amount of hours and minutes (x:xx) between certain entries in the column. Is there any way to do this? I can send a sample if that would make it easier.

    Thanks,

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Use =ABS(A1-A2) where cells A1 and A2 contain date values. Format the cell containing this formula as [h]:mm

  3. #3
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-06 07:30, dcecil wrote:
    I have a column that has a date/time format of dd/mm/yy hhmm. I need to calculate the amount of hours and minutes (x:xx) between certain entries in the column. Is there any way to do this? I can send a sample if that would make it easier.

    Thanks,
    Just subtract one value from the other and format your result as [h]:mm (e.g., =B1-A1).

    Regards,

    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

  4. #4
    New Member
    Join Date
    Mar 2002
    Location
    Fairfax, Virginia
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sorry guys, but both of the solutions that were given, return an error ($VALUE!). I think the date in the beginning of the field is messing it up. The fields looks like this: 3/6/02 0900 and 3/6/02 1515, which would return a value of 6:15. Hope this helps.

    Thanks,

  5. #5
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-06 07:52, dcecil wrote:
    Sorry guys, but both of the solutions that were given, return an error ($VALUE!). I think the date in the beginning of the field is messing it up. The fields looks like this: 3/6/02 0900 and 3/6/02 1515, which would return a value of 6:15. Hope this helps.

    Thanks,
    So your data is actually being read by Excel as a text value? Do you ever have the times span across a day (e.g., 3/6/02 0900 in one cell and 3/7/02 0300 in another)?


    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

  6. #6
    New Member
    Join Date
    Mar 2002
    Location
    Fairfax, Virginia
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Yes I do.

  7. #7
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Okay, assuming your higher date/time is in cell B1 and the lower one is in cell A1, try this formula:

    =TIMEVALUE(LEFT(B1,LEN(B1)-2)&":"&RIGHT(B1))-TIMEVALUE(LEFT(A1,LEN(A1)-2)&":"&RIGHT(A1))+DATEVALUE(LEFT(B1,LEN(B1)-2)&":"&RIGHT(B1))-DATEVALUE(LEFT(A1,LEN(A1)-2)&":"&RIGHT(A1))

    NOTE - this formula assumes the format of your times is always the same. That is, the last two characters always represents minutes.

    Regards,

    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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