+ Reply to Thread
Results 1 to 6 of 6

Format decimal to specific type of format

Hybrid View

greekboyuk Format decimal to specific... 02-25-2011, 06:20 AM
DonkeyOte Re: Format decimal to... 02-25-2011, 06:28 AM
greekboyuk Re: Format decimal to... 02-25-2011, 08:59 AM
DonkeyOte Re: Format decimal to... 02-25-2011, 09:28 AM
greekboyuk Re: Format decimal to... 02-25-2011, 09:54 AM
DonkeyOte Re: Format decimal to... 02-25-2011, 10:02 AM
  1. #1
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    Format decimal to specific type of format

    Hi there,

    I am trying to convert a number which shows decimal time formatting to a time formatting however to be displayed again as decimal. e.g


    Cell A2 = 24.25 (which is 24hours and 15minutes)
    Cell B2 should be equal to 24.15 (which is 24 hours and 15minutes)

    I tried to use the timevalue formula but is not displaying the format that I want and they all seem to stop after 24hours (displaying 0 values)


    Can anyone help please??
    Last edited by greekboyuk; 02-25-2011 at 09:55 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Format decimal to specific type of format

    Not clear if you want B2 to be 24.15 or 24:15 format as 24.15 - the two are very different values.

    For 24.15 as Decimal

    =DOLLARFR(A2,60)
    (DOLLARFR requires activation of Analysis ToolPak pre XL2007)

    or

    =INT(A2)+MOD(A2,1)*0.6
    If you want B2 as hours but format as though decimal then:

    =A2/24
    format as [hh].mm

  3. #3
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    Re: Format decimal to specific type of format

    Hi DonckeyOte,

    Thanks for your help. I used the "INT" and "Mod" formula and it works fine however the problem that I have is when I enter a negative value it is not converting it correctly. e.g

    A2= 5.5 (converts it to 5.30) which is great
    A2= -5.5 (converts it to 5.70) which is not correct for me. It should change it to -5.30

    Can we do that please?

    Many Thanks

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Format decimal to specific type of format

    One option:

    =ROUNDDOWN(A2,0)+MOD(A2,SIGN(A2))*0.6
    assumes A2 not 0
    Last edited by DonkeyOte; 02-25-2011 at 10:03 AM. Reason: other ex. not correct

  5. #5
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    Re: Format decimal to specific type of format

    Thank you very much DonckeyOte, you are a master.Do you mind writing the formula for the reverse option please? So I can allow the user if they only have the time e.g
    D2= 5.30 (time)
    E2= 5.50 (decimal) including negative values

    Currently I am using
    =IF(ISERROR(RIGHT(D2,LEN(D2)-FIND(".",D2)+1)),D2,LEFT(D2,FIND(".",D2)-1)+(ROUNDDOWN((RIGHT(D2,LEN(D2)-FIND(".",D2)+1)/0.6),2)))
    which doesnt allow negative time.

    If it is too much trouble not to worry.

    Many Thanks
    Last edited by greekboyuk; 02-25-2011 at 09:58 AM.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Format decimal to specific type of format

    To work in reverse:

    =ROUNDDOWN(A2,0)+MOD(A2,SIGN(A2))/0.6
    (above assumes A2 not 0 obviously)

+ 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