+ Reply to Thread
Results 1 to 8 of 8

Odd outcome with Formula

  1. #1
    Registered User
    Join Date
    12-14-2015
    Location
    Oklahoma
    MS-Off Ver
    Office365 64bit
    Posts
    18

    Question Odd outcome with Formula

    Hi everyone!

    Been using this great program since it's conception but this one has me a bit baffled.

    This is odd. Created a time-card and when the total time is multiplied by 10 (currently) gives me an odd number?
    37.22 X 10 = 372.17???? Shouldn't that be 372.20?
    Formula is Hours (H13:H32) times amount H34 =SUM(H13:H32)*H34
    see attached
    Master Time Sheet.xlsx


    Thanks for any help that can be provided.

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Odd outcome with Formula

    If you increase your decimal for Total Hours worked, you will see the number is actually 37.21667
    37.21667 * 10 is very close to 372.17

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Odd outcome with Formula

    Increase the number of decimals in H33 and you will see:

    37.2166667

    so perhaps you can see where you answer comes from.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    12-14-2015
    Location
    Oklahoma
    MS-Off Ver
    Office365 64bit
    Posts
    18

    Re: Odd outcome with Formula

    Thank you but still confused. any number times 10 ends in 0. SO why is the formula giving me an odd number when total hours are multiplied by 10? See what I am saying?

    Thank you for your quick responses, very appreciative.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Odd outcome with Formula

    The result is being rounded.

    The actual result of your formula in H33 is
    32.2166666toinfinity
    Excel will not actually calculate that 6 to infinity.
    It cuts off and rounds at 15 significant digits.
    32.2166666666667

    So the number being multiplied in H35 does actually end with a 7.

  6. #6
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Odd outcome with Formula

    Quote Originally Posted by SpartanCollege View Post
    Thank you but still confused. any number times 10 ends in 0. SO why is the formula giving me an odd number when total hours are multiplied by 10? See what I am saying?
    Yes. But you do not seem to see what everyone else is saying.

    The value in H33 only appears to be 37.22 because you format it to show 2 decimal places. The actual value is about 37.2166666666667.

    Ostensibly (over-simplified), 37.2166666666667 times 10 is about 372.166666666667, which Excel rounds to 372.17 because you format it to display 2 decimal places. "See what I am saying"?

    If you want H33 to actually be 37.22, the formula in H33 should be: =ROUND(SUM(H13:H32),2).

    For technical reasons, the formula in H34 should also be: =ROUND(H33*H34,2).
    Last edited by joeu2004; 12-14-2015 at 06:20 PM. Reason: cosmetic

  7. #7
    Registered User
    Join Date
    12-14-2015
    Location
    Oklahoma
    MS-Off Ver
    Office365 64bit
    Posts
    18

    Re: Odd outcome with Formula

    I see now, thank you.

  8. #8
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Odd outcome with Formula

    Quote Originally Posted by joeu2004 View Post
    Yes. But you do not seem to see what everyone else is saying. The value in H33 only appears to be 37.22 because you format it to show 2 decimal places. The actual value is about 37.2166666666667.
    What has not yet been explained yet is: why is H33 about 37.2166666666667 instead of 37.21 = 12 + 3 + 9 + 4 + 3.63 + 5.58, in the first place?

    That is more difficult to understand.

    As you seem to know, Excel time is stored as a decimal fraction. That is why you multiply the time difference by 24 in H13, for example.

    But most decimal fractions cannot be represented exactly in 64-bit binary floating-point, which Excel uses to represent numbers and perform arithmetic.

    So the actual values in H13:H18 are:
    Please Login or Register  to view this content.
    (I use period for the decimal point and comma to demarcate the first 15 significant digits, which is all that Excel formats.)

    Note that 3, 9, 3.63 and 5.58 are not represented exactly.

    You might think that 3 and 9 should be, because 3/24 and 9/24 can be represented exactly as 0.125 and 0.375. But the problem is: the decimal representation of 8:00, 10:00, 13:00 and 17:00 cannot be represented exactly.

    (FYI, 12 and 4 are exact only by coincidence.)

    PS.... The formulas in H13 should be of the form: =IF((F13-D13)>0,ROUND((F13-D13)*24,2),""). Then the sum in H33 will appear to be 37.21, as you might expect.

    [EDIT] It would be prudent to also write =IF(ROUND((F13-D13)*24,2)>0,....).
    Last edited by joeu2004; 12-14-2015 at 08:02 PM. Reason: cosmetic; PS; [EDIT]

+ 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. [SOLVED] maximum outcome in formula
    By BROEA in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-24-2015, 08:44 AM
  2. [SOLVED] Outcome of a formula as value for a variable
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-20-2014, 11:32 AM
  3. [SOLVED] Tripple outcome formula
    By tbenge05 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 03-21-2014, 11:48 AM
  4. [SOLVED] Displaying the outcome of a Formula in a message Box VBA
    By darby88 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-12-2012, 01:19 AM
  5. Multiple outcome IF formula
    By dm1983 in forum Excel General
    Replies: 2
    Last Post: 06-20-2010, 12:11 PM
  6. Incorrect formula outcome
    By leonidas in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-27-2006, 09:25 AM
  7. format the outcome of a formula
    By tinester in forum Excel General
    Replies: 3
    Last Post: 04-12-2006, 03:10 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