+ Reply to Thread
Results 1 to 15 of 15

Convert time to decimal value by formatting?

  1. #1
    Registered User
    Join Date
    05-25-2016
    Location
    Hollywood, CA
    MS-Off Ver
    2016
    Posts
    79

    Convert time to decimal value by formatting?

    I thought this would be an easy task - simply convert H:mm to a decimal value! I wasn't able to find a solution on any websites, ended up trying the HOUR function. Great as long as there aren't any minutes involved... I know there's got to be any easy way to do something as common as this must be, but it eludes me - can someone help me with this "simple" dilemma??

    Thanks for any help on this! Aaaaaaarrrggh...
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,080

    Re: Convert time to decimal value by formatting?

    Try this:

    =HOUR(SUM(E4-E3))+(MINUTE(SUM(E4-E3))/100)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Convert time to decimal value by formatting?

    Surely this is all you need??
    =B4-B3, copy across and format cells as hh:mm
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Registered User
    Join Date
    05-25-2016
    Location
    Hollywood, CA
    MS-Off Ver
    2016
    Posts
    79
    Quote Originally Posted by Glenn Kennedy View Post
    Surely this is all you need??
    =B4-B3, copy across and format cells as hh:mm
    I need decimal values, i.e., 3:45 is 3.75 hrs

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Convert time to decimal value by formatting?

    I can't read, it seems!!

    =(B4-B3)*24 formatted as general.

  6. #6
    Registered User
    Join Date
    05-25-2016
    Location
    Hollywood, CA
    MS-Off Ver
    2016
    Posts
    79

    Re: Convert time to decimal value by formatting?

    Quote Originally Posted by AliGW View Post
    Try this:

    =HOUR(SUM(E4-E3))+(MINUTE(SUM(E4-E3))/100)
    8 hours and 15 minutes comes out as 8.15 instead of 8.25

  7. #7
    Registered User
    Join Date
    05-25-2016
    Location
    Hollywood, CA
    MS-Off Ver
    2016
    Posts
    79

    Re: Convert time to decimal value by formatting?

    Quote Originally Posted by Glenn Kennedy View Post
    I can't read, it seems!!

    =(B4-B3)*24 formatted as general.
    I tried that - comes out as 8, not 8.25

  8. #8
    Forum Contributor
    Join Date
    05-06-2016
    Location
    Cluj, Romania
    MS-Off Ver
    2007-2010
    Posts
    220

    Re: Convert time to decimal value by formatting?

    Time is represented with decimal (days) values (1.00=24hours), so time value (in decimal hours) =TIME*24.
    =(B4-B3)*24 it`s OK, check your cells formated settings.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Convert time to decimal value by formatting?

    Thanks, TudyBTH. Trstew: here's the sheet to prove it!! I've added an error-trap, too, for purely cosmetic reasons.

    =IFERROR((B4-B3)*24,"")
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    05-25-2016
    Location
    Hollywood, CA
    MS-Off Ver
    2016
    Posts
    79

    Re: Convert time to decimal value by formatting?

    Yes, it DOES work - thank you guys so much! One more question - if I change B3 and B4 to 6pm and 1am, how do you make it come out as +7 instead of -17 hours?

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,908

    Re: Convert time to decimal value by formatting?

    Try

    =IFERROR((MOD(B4-B3,1))*24,"")

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Convert time to decimal value by formatting?

    I told you it worked!! Now for your next bit, try this:

    =IFERROR(MOD(B4-B3,1)*24,"")

    copy across

  13. #13
    Forum Contributor
    Join Date
    05-06-2016
    Location
    Cluj, Romania
    MS-Off Ver
    2007-2010
    Posts
    220

    Re: Convert time to decimal value by formatting?

    you must enter time as date and you can format cells to show just hour and minutes
    B3=07.08.2016 18:00:00, B4=08.08.2016 01:00:00
    Time is number between 0 (represents time 0:00 AM) and 0,999988425925926 (which represents time 23:59:59), 1.00 represent h 0:00 AM next day). B3 represent time of a day and B4 is time of another day.

  14. #14
    Forum Contributor
    Join Date
    05-06-2016
    Location
    Cluj, Romania
    MS-Off Ver
    2007-2010
    Posts
    220

    Re: Convert time to decimal value by formatting?

    you must enter time as date and you can format cells to show just hour and minutes
    e.g. B3=07.08.2016 18:00:00, B4=08.08.2016 01:00:00
    Time is number between 0 (represents time 0:00 AM) and 0,999988425925926 (which represents time 23:59:59), 1.00 represent h 0:00 AM next day). B3 represent time of a day and B4 is time of another day, so put those days in the cells if you want to be counted.

  15. #15
    Forum Contributor
    Join Date
    05-06-2016
    Location
    Cluj, Romania
    MS-Off Ver
    2007-2010
    Posts
    220

    Re: Convert time to decimal value by formatting?

    for moderators
    please delete msg #13 and this, I can not make it

+ 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. Convert Time to Decimal with Custom Time Matrix
    By john.fries in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-14-2016, 11:19 AM
  2. Convert time into decimal
    By keith740 in forum Excel General
    Replies: 2
    Last Post: 04-25-2015, 09:05 PM
  3. Convert time to decimal
    By ExpressTyping in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-29-2013, 11:27 PM
  4. Replies: 22
    Last Post: 09-15-2013, 10:43 AM
  5. [SOLVED] Need to convert time to decimal
    By JessicaW in forum Excel General
    Replies: 2
    Last Post: 10-02-2012, 05:33 PM
  6. Excel 2007 : Convert decimal to time
    By jbritt in forum Excel General
    Replies: 7
    Last Post: 01-03-2010, 08:10 PM
  7. Convert Decimal to Time
    By oberon.black in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2005, 04:21 PM

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