We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

excel formula not giving the correct answer

Options
2

Comments

  • WaywardDriver
    WaywardDriver Posts: 546 Forumite
    Seventh Anniversary 500 Posts
    edited 29 August 2020 at 6:02PM
    Stompa said:
    First decide what precision you want. e.g. to nearest 1/8". Then if 1.45 in cell A1:
    A2 =8*CONVERT(A1,"m","in") gives 456.69 (1/8th of inches)
    A3 =INT(A2/96) gives 4 (feet)
    A4 =INT((A2-A3*96)/8) gives 9 (inches)
    A5 =INT(0.5+A2-A3*96-A4*8) gives 1 (nearest 1/8inch)
    With some effort may be possible to combine into single formula.
    Though if you have 1.473 in A1 you get 4' 9 8/8". Whilst you could argue that that is correct, it's an odd way of writing it!
    A4 =INT((A2-A3*96)/8+1/16) seems to work for your example but 1.523 gives 4' 12 0/8" so more refinement needed.
  • Stompa
    Stompa Posts: 8,375 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    Stompa said:
    First decide what precision you want. e.g. to nearest 1/8". Then if 1.45 in cell A1:
    A2 =8*CONVERT(A1,"m","in") gives 456.69 (1/8th of inches)
    A3 =INT(A2/96) gives 4 (feet)
    A4 =INT((A2-A3*96)/8) gives 9 (inches)
    A5 =INT(0.5+A2-A3*96-A4*8) gives 1 (nearest 1/8inch)
    With some effort may be possible to combine into single formula.
    Though if you have 1.473 in A1 you get 4' 9 8/8". Whilst you could argue that that is correct, it's an odd way of writing it!
    Some refinement needed then!
    I suspect
    A2 =ROUND(8*CONVERT(A1,"m","in"),0)
    A3 =INT(A2/96)
    A4 =INT((A2-A3*96)/8)
    A5 =INT(A2-A3*96-A4*8)
    would be sufficient.
    Stompa
  • st999
    st999 Posts: 1,574 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    edited 30 August 2020 at 12:07AM
    no it gives 4'9.086616"

    It may give 4'9.086616" but it still shows (in excel) in the cell as  4'9" whereas if I open the saved spreadsheet in LibraOffice it shows as 4'9 1/9"
     I want to see 4'9 1/8" (or 4'9 1/9" if it is more accurate) in the cell in excel.
    This is excel
    4.76 4' 9"
    4.76 4' 9"
    5.81 5' 9 2/3"
    3.28 3' 3 1/3"
    3.28 3' 3 1/3"
    3.80 3' 9 2/3"
    3.80 3' 9 2/3"
    3.80 3' 9 2/3"
    and this is the same spreadsheet opened in LibreOffice
    4.76 4' 9 1/9"
    4.76 4' 9 1/9"
    5.81 5' 9 2/3"
    3.28 3' 3 3/8"
    3.28 3' 3 3/8"
    3.80 3' 9 2/3"
    3.80 3' 9 2/3"
    3.80 3' 9 2/3"
  • 4.8kWp 12x400W Longhi 9.6 kWh battery Giv-hy 5.0 Inverter, WSW facing Essex . Aint no sunshine ☀️ Octopus gas fixed dec 24 @ 5.74 tracker again+ Octopus Intelligent Flux leccy
  • st999
    st999 Posts: 1,574 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    It doesn't explain the discrepancy between excel and LibreOffice though.
  • WaywardDriver
    WaywardDriver Posts: 546 Forumite
    Seventh Anniversary 500 Posts
    edited 30 August 2020 at 9:04AM
    st999 said:
    It doesn't explain the discrepancy between excel and LibreOffice though.
    Seems spreadsheet precision bit of a minefield, see for example http://www.gnumeric.org/numerical-issues.html which indirectly contrasts Excel and LibreOffice calculation precision.  
    Would be useful to know what OP is trying to achieve - academic or real-life exercise? if latter then convert to what precision? 
  • st999
    st999 Posts: 1,574 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    Would be useful to know what OP is trying to achieve - academic or real-life exercise? if latter then convert to what precision? 
    I just wondered why using excel if I put 4.76 in a cell and get 4' 9 1/8" yet if I did the same calculation using 1.45*3.28 which also shows in the cell as 4.76 I get 4' 9" and if there was a way to fix it?

     
  • st999 said:
    Would be useful to know what OP is trying to achieve - academic or real-life exercise? if latter then convert to what precision? 
    I just wondered why using excel if I put 4.76 in a cell and get 4' 9 1/8" yet if I did the same calculation using 1.45*3.28 which also shows in the cell as 4.76 I get 4' 9" and if there was a way to fix it?

     
    The fundamental issue is to do with accuracy of the original figures i.e. 1.45 is to 3 significant figures so the answer should be also. Excel gives 1.45*3.28 as 4.756 which we should express as 4.76 to reflect the accuracy of the original measurement.
    To look at this another way, by expressing the measurement as 1.45m we're implying it's between 1.445 and 1.455 which according to the Excel formula I used corresponds to between 4' 8 7/8" and 4' 9 2/8". This difference of 3/8" makes any difference in precision between how Excel and LibreOffice do calculations somewhat academic. 
  • DoaM
    DoaM Posts: 11,863 Forumite
    10,000 Posts Fifth Anniversary Name Dropper Photogenic
    The fundamental issue is that 1.45 x 3.28 = 4.756 and not 4.76 ... 4.76 only show if you've set the cell formatting to 2 decimal places. The calculation still uses the 4.756 answer.
  • st999
    st999 Posts: 1,574 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    edited 30 August 2020 at 12:11PM
    If I add another column and roundup the answer to 1.45 x 3.28 = 4.756 and use that column I then get  4' 9 1/8" so basically it is a roundup error.
    4.76 4.76 4' 9" 4' 9 1/8"
    4.76 4.76 4' 9" 4' 9 1/8"
    5.81 5.81 5' 9 2/3" 5' 9 5/7"
    3.28 3.28 3' 3 1/3" 3' 3 1/3"
    3.28 3.28 3' 3 1/3" 3' 3 1/3"
    3.80 3.81 3' 9 2/3" 3' 9 5/7"
    3.80 3.81 3' 9 2/3" 3' 9 5/7"
    3.80 3.81 3' 9 2/3" 3' 9 5/7"
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.8K Banking & Borrowing
  • 253K Reduce Debt & Boost Income
  • 453.4K Spending & Discounts
  • 243.7K Work, Benefits & Business
  • 598.5K Mortgages, Homes & Bills
  • 176.8K Life & Family
  • 256.9K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.