+ Reply to Thread
Results 1 to 9 of 9

Calculate time difference in Excel

  1. #1
    Registered User
    Join Date
    09-30-2017
    Location
    Toronto, Canada
    MS-Off Ver
    Microsoft Office 2010
    Posts
    10

    Calculate time difference in Excel

    Hello Excel Forum,

    I am looking to find the difference between a beginning time and an ending time not using decimals, but using hours and minutes. I tried searching online but it has not translated to success. I am using a 24 hour clock, so PM and AM would not be involved in what is displayed in the cells.

    I tried using the formula =TEXT(D2-E2,"hh:mm") but received an error message.

    Please assist. I have also attached my excel spreadsheet for better understanding.

    An example of what I was looking to achieve was:

    Call Start time: 01:45

    Call End time: 01:50

    Elapsed time: 00:05 (hoping that a formula would calculate that the call was 5 minutes)
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,073

    Re: Calculate time difference in Excel

    Should be this:

    =TEXT(E2-D2,"hh:mm")

    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Calculate time difference in Excel

    Your formula is wrong
    D2 is the start time
    E2 is the end time

    Therefore the formula should be E2-D2 not D2-E2
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,477

    Re: Calculate time difference in Excel

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    but note that that gives you a text value, not a numeric time value.

    You could just use
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and Custome Format
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    which will be a numeric time value in the required format.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Calculate time difference in Excel

    I would simply use this:

    =E2-D2

    That way, Excel sees this value as a number (dates and times are seen as numbers to Excel).

    You shouldn't have to adjust any formatting to have the cell show as hh:mm

  6. #6
    Registered User
    Join Date
    12-18-2017
    Location
    Durban, South Africa
    MS-Off Ver
    365
    Posts
    8

    Re: Calculate time difference in Excel

    Continuing this thread and hopefully not breaking any forum rules as I think this will be relevant to the original poster.

    How does this impact going across midnight?

    For instance End time is 00:50 and start time is 23:56.

    It should be 54 minutes however does not seem to work.

    I realize the solution is probably to have date and time in the cell however this is not how the information is recorded. Is there anyway that excel can cater for this?

    Thank you

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Calculate time difference in Excel

    Quote Originally Posted by Pig243 View Post
    How does this impact going across midnight?
    It is not clear that this is directly relevant to the OP but I'll give you the benefit of the doubt.

    This formula is good only for an event that crosses midnight up to once.

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


    A slightly more "clever" version might be:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

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

    Re: Calculate time difference in Excel

    Another way:

    =E2-D2+(D2>E2)

    or:

    =MOD(E2-D2,1)

  9. #9
    Registered User
    Join Date
    12-18-2017
    Location
    Durban, South Africa
    MS-Off Ver
    365
    Posts
    8

    Re: Calculate time difference in Excel

    Thank you very much for the help!!

    This forum is fantastic!

+ 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. How to calculate time difference in Excel
    By Terressa in forum Excel General
    Replies: 1
    Last Post: 07-24-2015, 08:10 AM
  2. Replies: 3
    Last Post: 03-02-2012, 08:18 PM
  3. Calculate Time Difference
    By OceanBlue in forum Excel General
    Replies: 11
    Last Post: 09-02-2011, 03:47 PM
  4. Calculate the time difference
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-04-2010, 06:31 AM
  5. Excel Function to calculate difference in time in same cell
    By jr white in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-08-2007, 01:16 PM
  6. calculate difference of time
    By Xavier in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2006, 10:25 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