+ Reply to Thread
Results 1 to 10 of 10

Slightly incorrect formula results

  1. #1
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Slightly incorrect formula results

    Has anyone else had trouble with Excel being slightly out on its calculations? I've got a spreadsheet where I entered three sets of six weekly figures:

    £120.24 £13.00 £9.87
    £125.13 £12.00 £8.59
    £124.59 £14.00 £7.59
    £123.48 £15.00 £6.57
    £127.91 £16.00 £6.25
    £119.88 £13.00 £7.49

    The averages of these figures (which Excel gets right) are:

    £123.54 £13.83 £7.73

    If you then convert the averages from weekly to monthly (i.e. multiply by 52 and divide by 12), you get:

    £535.34 £59.93 £33.50

    But Excel gives me these:

    £535.33 £59.94 £33.48

    I could understand if the answers were consistently wrong (e.g. always 1p down), but as you can see, the first figure is 1p too low, the second figure is 1p too high, and the third figure 2p too low.

    Does anyone know what could be causing this? I formatted all three cells as currency with 2 decimal places, and the formula was copied across from one cell to another:

    =IF($F$3=$E$6,"N/A",IF($F$3=$E$5,G18,IF($F$3=$E$4,G18*13/12,IF($F$3=$E$3,G18*26/12,IF($F$3=$E$2,G18*52/12,"£0.00")))))

    =IF($F$3=$E$6,"N/A",IF($F$3=$E$5,H18,IF($F$3=$E$4,H18*13/12,IF($F$3=$E$3,H18*26/12,IF($F$3=$E$2,H18*52/12,"£0.00")))))

    =IF($F$3=$E$6,"N/A",IF($F$3=$E$5,I18,IF($F$3=$E$4,I18*13/12,IF($F$3=$E$3,I18*26/12,IF($F$3=$E$2,I18*52/12,"£0.00")))))
    Last edited by ianpwilliams; 05-06-2013 at 11:59 AM.

  2. #2
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Slightly incorrect formula results

    Floating-point Arithmetic may give inaccurate results

    http://support.microsoft.com/kb/78113

    How to correct rounding errors

    http://support.microsoft.com/kb/214118
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

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

    Re: Slightly incorrect formula results

    The problem is you have the cells formatted to only 2 decimal places.

    The average of the first column is NOT 123.54. It is actually 123.53833333
    But you have the cell formatted to only show 2 decimal places, so it 'Appears' to be rounded UP to 123.54.
    When in fact, that is only being DISPLAYED that way, but the actual complete value with 4+ decimals still exists in the cell.
    So when you're doing the *52/12, you're doing that on 123.5383333..NOT 123.54


    Hope that helps.

  4. #4
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Slightly incorrect formula results

    Jonmo is likely correct here.. but might I also offer a suggestion to your formula...

    Instead of multiple IFs, you could shorten it a bit to something like this:

    =IFERROR(CHOOSE(MATCH($F$3,$E$2:$E$6,0),G18*52/12,G18*26/12,G18*13/12,G18,"N/A"),0)

    Excel is great... there are lots of ways to do the same thing. =)

    - Moo
    Last edited by Moo the Dog; 05-06-2013 at 12:04 PM.

  5. #5
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: Slightly incorrect formula results

    Oh ok, I see what it was doing. I tried method 2 - ticking the "Precision as Displayed" option - and that seems to work fine. The warning "data will permanently lose accuracy" was a bit ominous though!

    As it happens, I will be integrating my spreadsheet into another spreadsheet (which also works with currency to two decimal places), and I had noticed that the rounding was occasionally a bit odd in that one too. So activating that option in the other spreadsheet should also fix that.

    Thanks for the help everyone!

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

    Re: Slightly incorrect formula results

    I would recommend using the ROUND function instead of the precision as displayed.
    Because of the ominous warning that it's permanent AND it applies to ALL Numbers..

    So just round the result of your average..

    =ROUND(AVERAGE(....),2)

  7. #7
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: Slightly incorrect formula results

    Well if the whole spreadsheet (and the spreadsheet it is to be integrated into) only works with currency to two decimal places anyway, then it should be ok shouldn't it? I'd rather not have to add the ROUND function to every formula on my two tabs, and then also to all of the formulas in the tabs of the other spreadsheet too...

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

    Re: Slightly incorrect formula results

    I guess it depends on which answer you believe is correct.

    Do you want the rounding happening after the Average, then do the *52/12 ?
    Or do you want to do the Average*52/12 and THEN round it?

    In my opinion the more accurate result is to do ALL the math with the actual complete numbers first, THEN round that result.
    So the results Excel intially gave you actually are the most accurate numbers.
    But Excel gives me these:
    £535.33 £59.94 £33.48

    But this is all just a matter of opinion, it's your sheet.

  9. #9
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: Slightly incorrect formula results

    Yes it's an interesting one. Normally it would be done with a calculator, and I suppose you would do the whole calculation at once, so it would be a case of not using "Precision as Displayed". The only thing that makes it slightly awkward is that the spreadsheet displays the average in one cell, and then the monthly average in another cell, both with 2 decimal places. So someone could take a calculator and convert that average, and see that the answer isn't quite the same, and think that the spreadsheet was wrong. I'll just have to find out what people would prefer. At least I know what my options are now though, and how each option works.

  10. #10
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,289

    Re: Slightly incorrect formula results

    Another point is:
    1 year has 12 month
    1 year has 52 weeks + 1 ( or2) days
    Thus 12 month is not equal to 52 weeks!!
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

+ 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