+ Reply to Thread
Results 1 to 9 of 9

converting time difference to percentage

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    converting time difference to percentage

    hi guys,

    i am trying to get the time difference and convert it to percentage but i have no idea how to do it...like if time is 11:30 AM minus 12:00 PM, then this gives me a #value result instead...and how do i get the percentage for this? attached is a sample workbook..

    regards,

    stoey
    Attached Files Attached Files
    Last edited by stoey; 09-23-2011 at 02:23 PM.

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

    Re: converting time difference to percentage

    Your formula in c2 refers to A1 which contains text - hence #VALUE! error - change to this

    =(B2-A2)*24

    Presumably M2 should be

    =SUM(C2,G2,K2)

    so try this for N2

    =IF(M2>1.25,0%,100%)
    Audere est facere

  3. #3
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Re: converting time difference to percentage

    hi there daddy,

    i tried your solution and it worked perfectly however after a couple of tweaking and substituting the formula to another solution, results doesn't seem becomes right...attached is a sample of the workbook

    regards,

    stoey
    Attached Files Attached Files

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

    Re: converting time difference to percentage

    Why are H2 and L2 wrong - the results seem consistent with the formulas - can you describe in words what you want the formula to do, is it possible you need >= rather than > ?

    For N2 try

    =IF(AND(D2=100%,H2=100%,L2=100%),100%,0%)

  5. #5
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Re: converting time difference to percentage

    hi daddy,

    that im not sure why it doesn't shows consistent results though they have the same formula...in this formula:

    =IF(G2>0.25,0%,100%) - this should display 100% if the results are less than or equal to 0.25 ...i tested using exact result of 0.25 but it gives me a 0% remark in which it should be 100%

    the other formula which is almost the same as above also gives wrong results

    =IF(K2>0.5,0%,100%) this should display 100% if the result is equal or less than 0.5...tested this as well using exact 0.5 result but it displays 0%

    i dont really get it why it works on the on the first part just like in my sample attached file but doesnt work on the other...

    regards,

    stoey

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

    Re: converting time difference to percentage

    If you format G2 to show 15 decimal places you can see that the number in there is slightly larger than 0.25. Try using ROUND in G2, e.g. change to this

    =ROUND((F2-E2)*24,9)

    then the H2 formula should work as required. ROUND the other cells in the same wqay

  7. #7
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Re: converting time difference to percentage

    alright! things are working perfectly now...final question is what does round do and likewise what does 9 mean in this formula:

    =ROUND((F2-E2)*24,9)

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

    Re: converting time difference to percentage

    In this case you are rounding to 9 decimal places - that makes no practical difference to the result but it gets rid of the small decimal places that were throwing out your formulas

  9. #9
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Re: converting time difference to percentage

    i see...just what i expected...thanks a lot!

+ 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