+ Reply to Thread
Results 1 to 7 of 7

Subtracting Dates

  1. #1
    Registered User
    Join Date
    06-17-2013
    Location
    Boston, Ma
    MS-Off Ver
    Excel 2003
    Posts
    8

    Subtracting Dates

    Hello,

    I am trying to subtract two date fields, both of which are formatted like this: 4/15/2013 12:10:00 AM, with date first and then time. I am trying to subtract the two so I can tell what the time difference is between the two.

    For example: Say these are the two cells 4/15/2013 8:59:00 AM and 4/15/2013 12:10:00 AM. I would like to find the time difference, which in this case would be 8:49. Please help!

    Thank you greatly.
    -Leo

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Subtracting Dates

    Hi and welcome to the forum

    You should be able to just subtract 1 from the other - and then format as hours/minutes?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Subtracting Dates

    hi Leo, welcome to the forum. assuming the 2 are in A1 & B1 respectively, simply:
    =A1-B1

    that's the fraction of a day.
    format as:
    [h]:mm

    if you need 8:30 hours shown as 8.5, then:
    =(A1-B1)*24

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Subtracting Dates

    Hi Leo and welcome to the forum,

    I wonder if your version of excel knows about DateDif?

    http://www.cpearson.com/excel/datedif.aspx or
    http://office.microsoft.com/en-us/he...001160981.aspx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    06-17-2013
    Location
    Boston, Ma
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Subtracting Dates

    Wow, that was easy. Thanks guys! Now that I have done that, some fields that have day and time differences show up like this: 1/1/00 6:16, meaning 1 day, 6 hours and 16 minutes time difference. However, I would like it to just show up as 30 hours and 16 minutes, converting days to hours in order to keep it formated as "time". Is that possible?

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Subtracting Dates

    maybe try this?

    =INT(A1-B1)*24+MOD(A1-B1,1)

  7. #7
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Subtracting Dates

    or custom format as such:
    [h]" hours and" mm" minutes"

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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