+ Reply to Thread
Results 1 to 10 of 10

CSV Number rounding

  1. #1
    Forum Contributor
    Join Date
    09-18-2007
    Posts
    116

    Angry CSV Number rounding

    Hello,

    I have a section of code that build a single sheet workbook that incudes names and phone numbers to upload in to a web site.

    The numbers are in internation format eg 4412345678987

    The code works fine but when it saves as a CSV Delimited it round the numbers up so they end up 4412346000000

    any ideas how to stop this

    thanks

    Dave
    Last edited by stoney1977; 10-27-2009 at 05:37 AM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,076

    Re: CSV Number rounding

    Try adding a text character e.g. a space?
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Contributor
    Join Date
    09-18-2007
    Posts
    116

    Re: CSV Number rounding

    nope putting a space on the end made no diffrence

  4. #4
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: CSV Number rounding

    Please show your code - if structured correctly that wouldn't happen.
    Richard Schollar
    Microsoft MVP - Excel

  5. #5
    Forum Contributor
    Join Date
    09-18-2007
    Posts
    116

    Re: CSV Number rounding

    Quote Originally Posted by RichardSchollar View Post
    Please show your code - if structured correctly that wouldn't happen.
    Its not an error in the code as it only happens one the CSV has been saved and closed. When you reopen it the numbers have been rounded.

    I have checked this by stopping the code before I close the CSV file and it all looks fine. Then i save it as a csv file when you reopen it the number have changed.

  6. #6
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: CSV Number rounding

    Have you checked what the actual output is in the csv file itself? Please note you cannot do this by opening the csv file up in Excel - Excel performs automatic conversions on data in csv files. Instead you would need to open the csv file in a text editor (such as Notepad).

  7. #7
    Forum Contributor
    Join Date
    09-18-2007
    Posts
    116

    Re: CSV Number rounding

    Quote Originally Posted by RichardSchollar View Post
    Have you checked what the actual output is in the csv file itself? Please note you cannot do this by opening the csv file up in Excel - Excel performs automatic conversions on data in csv files. Instead you would need to open the csv file in a text editor (such as Notepad).
    the CSV shows as 4.47826E+11 which looks like a formating issue.

    DO you have any ideas

  8. #8
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: CSV Number rounding

    If that number is what is in the csv when you open it up in Notepad or some other text editor then it is showing that there is something wrong with the save process. In which case we need to see your code.

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,966

    Re: CSV Number rounding

    Were the numbers displayed like that in Excel when you saved the csv file by any chance?
    Everyone who confuses correlation and causation ends up dead.

  10. #10
    Forum Contributor
    Join Date
    09-18-2007
    Posts
    116

    Re: CSV Number rounding

    I have fixed it.
    By setting the number format in the cell as "0000"

    Thanks

+ 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