+ Reply to Thread
Results 1 to 9 of 9

Subtracting times

Hybrid View

  1. #1
    Registered User
    Join Date
    01-16-2008
    Posts
    28

    Subtracting times

    Hi,

    I would like to know what the formula is for subtracting 2 given times. For example...

    A1 = 8/31/2009 05:17:25 PM and B1 9/1/2009 05:44:39 AM

    I would like for cell C1 to calculate the total number of hours different from A1and B1..

    Any help is greatly appreciated. Thanks!

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    re: Subtracting times

    TRy:

    =(B1-A1)*24
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Valrico, FL USA
    MS-Off Ver
    Excel 2016
    Posts
    358

    re: Subtracting times

    Will this work for you?
    =HOUR(B1-A1)&"Hours "&MINUTE(B1-A1)&"Minutes "&SECOND(B1-A1)&"Seconds"

  4. #4
    Registered User
    Join Date
    01-16-2008
    Posts
    28

    re: Subtracting times

    This is what it gives me 1/12/1900 10:53:36AM...is there a way to make it where it only shows, for example, 10 hours?

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    re: Subtracting times

    Format that result cell as General.

    If you just want hours...

    =INT((B1-A1)*24)

    formatted as General
    Last edited by NBVC; 10-06-2009 at 01:19 PM.

  6. #6
    Registered User
    Join Date
    01-16-2008
    Posts
    28

    Re: Subtracting times

    This WORKS!!! BIG Thank You to you guys!

  7. #7
    Registered User
    Join Date
    01-16-2008
    Posts
    28

    Re: Subtracting times

    Another example...

    A1 = 9/4/2009 01:28:02 PM B1 = 9/8/2009 08:59:21 AM

    result I got was 19Hours 4Minutes 19Seconds

    Isn't this wrong since there is a 3 working days difference between cell A1 and B1?

    each day should of already been 24 hours.

  8. #8
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Valrico, FL USA
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Subtracting times

    Modified Formula:

    =DAY(B1-A1)&"Days "&HOUR(B1-A1)&"Hours "&MINUTE(B1-A1)&"Minutes "&SECOND(B1-A1)&"Seconds"

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,719

    Re: Subtracting times

    Hello ncmay,

    If the period was longer than 31 days then you wouldn't get the correct number of days using DAY function, better to use INT, for example

    =INT(B1-A1)&" Days "&TEXT(B1-A1,"hh:mm:ss")

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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