+ Reply to Thread
Results 1 to 11 of 11

Calculating elapsed time between two dates and times

  1. #1
    Registered User
    Join Date
    03-20-2008
    Location
    California, USA
    MS-Off Ver
    Excel for the Web, Build 16.0.1
    Posts
    19

    Calculating elapsed time between two dates and times

    Hello!

    I'm not sure if this is possible because my search results only yielded how to calculate elapsed time between two times or between two dates.

    I'm looking for a way to calculate elapsed time between two dates AND times e.g. March 15, 2021 10:33pm to March 16, 2021 7:0am. Is this possible? My spreadsheet has the first set of dates and times in Columns A and B, respectively, and the second set of dates and times in Columns C and D. If this IS possible, I would also like to be able to customize the results to display elapsed days and hours, or total hours only.

    A small screenshot showing the columns in my spreadsheet:
    Screen Shot 2021-04-08 at 08.30.40.png

    Thanks!

    Chris
    Last edited by OMMBoy; 04-08-2021 at 11:33 AM. Reason: Added screenshot and updated verbiage.

  2. #2
    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: Calculating elapsed time between two dates and times

    Yes! You simply subtract. But you said you have dates in column A and times in column B. What are the two dates/times you want the elapsed time for? Your formula will look something like

    =A2+B2-A1-B1

    assuming you want to take the date/time in row 2 and get the time elapsed from the date/time in row 1.

    Use the custom format

    d h

    and the result will be elapsed days and hours.

    [h]

    will give total hours
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    03-20-2008
    Location
    California, USA
    MS-Off Ver
    Excel for the Web, Build 16.0.1
    Posts
    19

    Re: Calculating elapsed time between two dates and times

    Hi, Jeff!

    Thanks for your quick reply! It appears I didn't save the changes to my post before posting it, thereby inadvertently omitting the columns in which the second set of dates and times are in. I've updated the post to reflect this, and I've also included a screenshot of a portion of my spreadsheet for reference.

    Using your formula as a starting point (geez, why didn't I realize it was so simple?), I came up with this: =(C6+D6)-(A6+B6). Sometimes I tend to overthink a problem and get myself stuck. smh

    Thank you so much for your help

    Chris

  4. #4
    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
    80,867

    Re: Calculating elapsed time between two dates and times

    Administrative Note:

    Please add your Office version to your forum profile.

    Although we value your privacy as much you do, it could be important that members have a rough idea of your location as the solutions they offer may be affected by your locale. For instance, you might in the future post questions which are related to your regional settings.

    With this in mind, please update your profile to something more precise (something such as UK, Europe, USA, UAE, etc. will suffice).

    Thank you for helping us to help you.
    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.

  5. #5
    Registered User
    Join Date
    03-20-2008
    Location
    California, USA
    MS-Off Ver
    Excel for the Web, Build 16.0.1
    Posts
    19

    Re: Calculating elapsed time between two dates and times

    So, I've run into a small issue that I'm sure I am overthinking again. Combine that with my limited skillset using Excel and it spells disaster. LOL!

    Anyway, it appears that Excel is not properly calculating the duration across multiple days (see screenshot below). The formula I am using is: =(C35+D35)-(A35+B35). What am I missing?

    Attachment 727465

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Calculating elapsed time between two dates and times

    Please read the yellow banner at the top of this page on how to attach a file.

  7. #7
    Registered User
    Join Date
    03-20-2008
    Location
    California, USA
    MS-Off Ver
    Excel for the Web, Build 16.0.1
    Posts
    19

    Re: Calculating elapsed time between two dates and times

    I'm sharing a portion of the worksheet here (per JohnTopley's post), with the hopes that we can figure this thing out.

    The "Duration" column's formulas doesn't seem to be properly calculating anything over 24 hours (see rows 4 and 5).

    Thanks to everyone for your help and contributions with this

    Chris
    Attached Files Attached Files
    Last edited by OMMBoy; 04-08-2021 at 04:25 PM.

  8. #8
    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
    80,867

    Re: Calculating elapsed time between two dates and times

    Did you set the custom cell formatting to [hh]:mm? If not, you won’t get hours over 24.

  9. #9
    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: Calculating elapsed time between two dates and times

    It is calculating it correctly but your format is not quite what I suggested. As Ali notes it must be

    [h]:mm

    You need the brackets around the hours for over 24.

  10. #10
    Registered User
    Join Date
    03-20-2008
    Location
    California, USA
    MS-Off Ver
    Excel for the Web, Build 16.0.1
    Posts
    19

    Re: Calculating elapsed time between two dates and times

    I think it's working now. I was trying to edit the spreadsheet in Excel for the Web which was uploaded to our company server by another user. This version wouldn't allow me to set a custom format and gave me the error "Creating custom number formats isn't currently supported in the web version of Excel, but your existing custom formats are still available." I was finally able to obtain the original file and set the proper custom format (see attachment).

    Thanks to everyone for your help and patience with this — you are all awesome :)

    Chris
    Attached Files Attached Files

  11. #11
    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
    80,867

    Re: Calculating elapsed time between two dates and times

    That's correct - you need to open the file in the desktop app to create and update custom formats, which of course you can do directly from the browser ribbon. When you say 'obtain' the original file, I am not sure quite what you mean, but it's important that you always work on the shared version, not a copy of it.

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

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. [SOLVED] Calculating time elapsed between 2 dates excluding PH and non-business hours
    By kersplash in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-20-2018, 11:53 PM
  2. Replies: 3
    Last Post: 04-30-2018, 11:46 PM
  3. Replies: 2
    Last Post: 04-01-2016, 12:03 AM
  4. Replies: 10
    Last Post: 03-31-2014, 01:18 PM
  5. [SOLVED] How do you calculate elapsed time in hours between times on different dates?
    By RPeruzzi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-10-2013, 01:16 PM
  6. calculate elapsed time between dates and times
    By Jenna in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-25-2006, 12:45 PM
  7. Replies: 6
    Last Post: 03-25-2005, 03: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