+ Reply to Thread
Results 1 to 6 of 6

Convert [h]:mm to decimal hours

  1. #1
    Registered User
    Join Date
    08-15-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Question Convert [h]:mm to decimal hours

    Hello all. I'm using the method I found in this forum to calculate the time between 2 dates & time - http://www.excelforum.com/excel-form...=1#post1982655

    Didn't think it'd be that simple

    Now that I have the value in [h]:mm, how do I convert it into decimal hours?

    Thanks in advance.

  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,929

    Re: Convert [h]:mm to decimal hours

    try using format special 00.00.00
    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
    Registered User
    Join Date
    08-15-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Convert [h]:mm to decimal hours

    Hi FDibbins, I did that but it didn't work. I was thinking to do a string tokenizer method since the number format is like 440:06:15. It'd extract "440" as the hour and "06" divided by 60 into decimal, then put those two together. Is that possible?

    EDIT: It would show 440.1 decimal hours.

    EDIT [SOLUTION]:

    I solved it. A bit long winded but it works.

    I convert the value to text with =TEXT(E1,"[h]:mm"). Then, using =LEFT(E1,SEARCH(":",E1)-1)+ MID(E1,SEARCH(":",E1)+1,20)/60 I now have the value in decimal hours
    Last edited by edgarrm; 08-15-2012 at 01:38 AM.

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

    Re: Convert [h]:mm to decimal hours

    440:06:15 actually looks like 1/18/1900 8:06:15 AM when you look at it in the formula bar. try this tho. with your time in A1, =DAY(A1)*24+HOUR(A1)+MINUTE(A1)/60

    let me know how that works for you?

  5. #5
    Registered User
    Join Date
    08-15-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Convert [h]:mm to decimal hours

    Quote Originally Posted by FDibbins View Post
    440:06:15 actually looks like 1/18/1900 8:06:15 AM when you look at it in the formula bar. try this tho. with your time in A1, =DAY(A1)*24+HOUR(A1)+MINUTE(A1)/60

    let me know how that works for you?
    It works too! And it's less steps too. Thank you very much.

  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,929

    Re: Convert [h]:mm to decimal hours

    you'r welcome, and thx for the star

+ 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