+ Reply to Thread
Results 1 to 8 of 8

How to subtract two dates & times to find the difference?

  1. #1
    Registered User
    Join Date
    07-22-2019
    Location
    New York, NY
    MS-Off Ver
    Latest
    Posts
    2

    How to subtract two dates & times to find the difference?

    Hi,

    I am trying to subtract two different dates & times to figure out the number of hours that have lapsed between the two, but cannot figure out a formula to work.

    Here is a snippet of an example of what I need the difference between:

    Example.PNG

    Thank you so much.

  2. #2
    Registered User
    Join Date
    07-22-2019
    Location
    Reading, England
    MS-Off Ver
    2016
    Posts
    4

    Re: How to subtract two dates & times to find the difference?

    surely its just the latest take away the other which is then in a serial number which you convert to days?

  3. #3
    Registered User
    Join Date
    07-22-2019
    Location
    New York, NY
    MS-Off Ver
    Latest
    Posts
    2

    Re: How to subtract two dates & times to find the difference?

    When I just subtract the two, it comes back as January 0, 1900

  4. #4
    Registered User
    Join Date
    12-10-2018
    Location
    Canada
    MS-Off Ver
    Microsoft 365
    Posts
    54

    Re: How to subtract two dates & times to find the difference?

    Convert the dates to numbers (may have to type in the long form)(June 12, 2019) which changes to 43628 days. etc... and just subtract the two cells to get the number of days.

    Example:

    July 1, 2019 changes to 01-Jul-19 in excel and June 30, 2019 changes to 30-Jun-19 and subtract the two is 1. If you're looking to add the time as well, you'll have to separate the time column... and convert it to a time value (6 hrs = .25 days)
    Last edited by Cleetus09; 07-22-2019 at 03:03 PM.

  5. #5
    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: How to subtract two dates & times to find the difference?

    Quote Originally Posted by Cleetus09 View Post
    Convert the dates to numbers (may have to type in the long form)(June 12, 2019) which changes to 43628 days. etc... and just subtract the two cells to get the number of days.

    Example:

    July 1, 2019 changes to 01-Jul-19 in excel and June 30, 2019 changes to 30-Jun-19 and subtract the two is 1. If you're looking to add the time as well, you'll have to separate the time column... and convert it to a time value (6 hrs = .25 days)
    Dates ARE numbers, so no need to convert them.
    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

  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: How to subtract two dates & times to find the difference?

    Quote Originally Posted by teamtargaryen View Post
    When I just subtract the two, it comes back as January 0, 1900
    What you need to understand about dates and times in excel is…

    a date is just a number representing the number of days passed since 1/1/900...and then formatted in a way that we recognize as a date. So, for instance, today (Mon 22 Jul 2019) is actually 43668

    Time is actually a decimal part of 1 (day), so 06:00 AM is 0.25, 12 noon is 0.5 and 18:00 (or 6 PM) is 0.75

    So, January 0, 1900 is actually excel's way of saying the answer is 0 (zero), but is showing it in date format.

    It looks to me like it should just be =C2-E2 ...formatted as General or Number.
    Your answer will still have a decimal - from the TIME portion, you can remove that by using ROUND
    =ROUNDDOWN(C2-E2,0)

  7. #7
    Registered User
    Join Date
    12-10-2018
    Location
    Canada
    MS-Off Ver
    Microsoft 365
    Posts
    54

    Re: How to subtract two dates & times to find the difference?

    "It looks to me like it should just be =C2-E2 ...formatted as General or Number.
    Your answer will still have a decimal - from the TIME portion, you can remove that by using ROUND
    =ROUNDDOWN(C2-E2,0)"


    You just reiterated what i said earlier. You use convert to numbers. and subtract the two cells. and bingo bango there's your answer

  8. #8
    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: How to subtract two dates & times to find the difference?

    Quote Originally Posted by Cleetus09 View Post
    ...You just reiterated what i said earlier. You use convert to numbers. and subtract the two cells. and bingo bango there's your answer...
    No, I did not re-iterate what you said, there is no need to "convert to numbers" - as I have already said, dates are already numbers, they are just formatted by excel to show something we recognize as a date.

+ 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. Replies: 4
    Last Post: 01-14-2019, 01:33 PM
  2. [SOLVED] Difference Between Dates & Times
    By mycon73 in forum Excel General
    Replies: 3
    Last Post: 03-25-2018, 12:54 PM
  3. [SOLVED] Subtract Dates & Times From Multiple Cells To Get Duration
    By sshot1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-20-2012, 10:34 AM
  4. Replies: 5
    Last Post: 05-18-2012, 10:24 AM
  5. [SOLVED] Difference in dates calculations except between certain times.
    By Steve Hud in forum Excel General
    Replies: 1
    Last Post: 01-13-2006, 09:15 AM
  6. [SOLVED] Difference between 2 times and dates
    By Stefan Buijs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2005, 05:19 PM
  7. [SOLVED] Difference between 2 times and dates
    By Stefan Buijs in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-26-2005, 05:15 PM

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