+ Reply to Thread
Results 1 to 10 of 10

Excel format error

  1. #1
    Forum Contributor
    Join Date
    12-30-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    143

    Excel format error

    Hi

    I seem to be having this weird problem

    in cell A1 i have a number formatted as accounting $13,914.40 in cell B1 i have a number $13,881.75

    When i minus cell A1 from cell B1 to get the difference i get this $32.649999999999600

    why ?

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Excel format error

    To find out, increase the number of decimal points for cells A1 and B1 - eventually you should find some anomaly. It's to do with rounding and what is known as the floating point error.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    12-30-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    143

    Re: Excel format error

    deciaml error.JPG

    actually that is not correct as you can see in the picture

  4. #4
    Registered User
    Join Date
    08-10-2018
    Location
    PDX
    MS-Off Ver
    365
    Posts
    10

    Re: Excel format error

    Select the cell that is formatted wrong and right click on it, choose format cell/ currency/ set decimal places to 2.

  5. #5
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: Excel format error

    You could set precision as displayed.
    File>Options>Advanced>When Calculating This Workbook>Check

    Pete

  6. #6
    Forum Contributor
    Join Date
    12-30-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    143

    Re: Excel format error

    The formatting will only help how it shows on the screen

    the problem is i'm entering 32.65 on an excel macro to do something with that number, and its not recognizing because internally,y its still $32.649999999999600

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Excel format error

    Quote Originally Posted by BORUCH View Post
    Attachment 586219

    actually that is not correct as you can see in the picture
    You may not have gone far enough. Hard to tell without seeing the workbook for myself.

    the problem is i'm entering 32.65 on an excel macro to do something with that number, and its not recognizing because internally,y its still $32.649999999999600
    So this is a VBA question? Do you need help with rounding in VBA, then?

  8. #8
    Forum Contributor
    Join Date
    12-30-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    143

    Re: Excel format error

    yes i guess my issue is rounding with vba

    but what would i round it to in an excel formula if i want it to show 32.65

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Excel format error

    Two decimal places:

    =ROUND(A1,2)

    I don't know how it's done in VBA - sorry. Should I move the thread for you?

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Excel format error

    To read more about the floating point issue...
    https://www.microsoft.com/en-us/micr...wrong-answers/

    Note that "showing" only 2 decimals in excel and "having" only 2 decimals is not necessarily the same thing.

    Ali's suggestion will remove (completely) all points after the 2nd decimal, but FORMATTING will still show 2 decimals, but the cell will continue to contain more decimals (if there are more)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. VBA Code Excel 2010 to Excel 2011 for Mac - Possible format error in Mac?
    By Gunners899 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 04-29-2015, 05:41 AM
  2. Excel 2007 : Excel 2007 format error
    By andyra in forum Excel General
    Replies: 0
    Last Post: 03-25-2010, 09:37 AM
  3. Excel Mac Tab-Delimited Format Error
    By timewaves in forum Excel General
    Replies: 0
    Last Post: 08-08-2008, 05:43 PM
  4. cell format error (Excel 2003)
    By technewb in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2007, 07:44 PM
  5. Too Many Different Cell Format error in Excel 2003
    By jkimball in forum Excel General
    Replies: 1
    Last Post: 07-24-2006, 12:59 PM
  6. [SOLVED] Excel Error! The file is not in a recognizable format?
    By Naveed Khan in forum Excel General
    Replies: 1
    Last Post: 07-05-2006, 08:35 AM
  7. How do I fix a date format error in Excel?
    By Dale_C141 in forum Excel General
    Replies: 2
    Last Post: 05-27-2006, 01:15 AM

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