+ Reply to Thread
Results 1 to 8 of 8

Converting days hours minutes to hours

  1. #1
    Registered User
    Join Date
    07-07-2011
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Converting days hours minutes to hours

    Hi,

    I have a list of times in dd:hh:mm format. For example: 02:17:23 for 2 days, 17 hours and 23 minutes.

    How do I convert this into a number/decimal format for hours only?

    Thanks in advance for any help!

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Converting days hours minutes to hours

    Try =24*(LEFT(A1,2) + MID(A1,4,5))
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    07-07-2011
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Converting days hours minutes to hours

    No, that doesn't work.

  4. #4
    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: Converting days hours minutes to hours

    Is the data text, or date/time? If it's text then shg's solution should work. If it's date/time then it is being stored as "days since January 1 1900". Date/time in Excel is a floating point number in units of days. To get hours just multiply by 24:

    =INT(A1)*24
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Converting days hours minutes to hours

    It works for your example, returning 65-odd hours, does it not?

  6. #6
    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: Converting days hours minutes to hours

    Quote Originally Posted by shg View Post
    It works for your example, returning 65-odd hours, does it not?
    I tried it for the example formatted as a text string and it works. If the example is 2.724305 custom formatted as "dd:hh:mm" then it does not work, and multiplying by 24 works.

    So the OP needs to specify just what the data is.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Converting days hours minutes to hours

    i dont see how you could use a date to represent a number of days,how would you get more than 31 days if it was a date number ?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  8. #8
    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: Converting days hours minutes to hours

    Quote Originally Posted by martindwilson View Post
    i dont see how you could use a date to represent a number of days,how would you get more than 31 days if it was a date number ?
    Good point, this approach does not work if you go over 31:59:59. All the more reason that namip needs to come back and tell us the details.

+ 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