+ Reply to Thread
Results 1 to 2 of 2

Formula of two 2-decimal numbers returns an extended decimal number

  1. #1
    Registered User
    Join Date
    08-09-2022
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    1

    Formula of two 2-decimal numbers returns an extended decimal number

    Subtracting one 2-decimal point number from another 2-decimal point number returns an eleven decimal point number. Why and how do I fix it?

    example:

    Cell B24=TRUNC(SUM(B22:B23),2) (value =134,388.33)
    Cell C24=TRUNC(SUM(D22:D23),2) (value = 132,257.12)
    Cell C25=B24-D24 (value = 2131.209999999990)

    Why is the result to 11 decimal places when the two inputs are truncated at 2 decimal?

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,460

    Re: Formula of two 2-decimal numbers returns an extended decimal number

    This is a well-known artifact of binary floating point arithmetic. There is no "fix" for this. As programmers, we can only cope with it. Most coping strategies in Excel revolve around rounding functions -- maybe =ROUND(B24-D24,2). Even then, you need to be aware that most terminating decimal fractions cannot be exactly represented in binary, so the problem can still be there.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ 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. Replies: 1
    Last Post: 05-03-2022, 05:13 AM
  2. [SOLVED] A Formula Which Turns Numbers Into Text With A Specific Decimal Number Amount
    By zanshin777 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-01-2018, 04:55 PM
  3. Replies: 3
    Last Post: 08-28-2013, 08:45 AM
  4. Replies: 2
    Last Post: 06-29-2012, 07:52 PM
  5. Formula returns odd decimal number
    By endoskeleton in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2011, 04:30 PM
  6. Paste two decimal number in excel without extra decimal places appearing
    By jeffery_frick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2009, 07:49 PM
  7. Replies: 5
    Last Post: 12-08-2005, 04:25 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