+ Reply to Thread
Results 1 to 9 of 9

HELP.. not sure what is happening, numbers being rounded

  1. #1
    Forum Contributor
    Join Date
    01-08-2017
    Location
    Salt Lake City, Ut.
    MS-Off Ver
    2019 and 365
    Posts
    135

    Question HELP.. not sure what is happening, numbers being rounded

    I am totally baffled. I have created an excel workbook with multiple sheets, including monthly sheets, labeled Jan thru Dec. In my code I create backup exported CSV files of these sheets. Inspecting the CSV files shows all data is backed up correctly.

    I then created code to import this data back in, should some corruption occur or be needed.

    Each sheet contains multiple columns, several of which include monthly expenses. The first column E imports expense data properly which might show the expense of 54.40 as 54.4, and then I use some conversion code to convert the number to a 2 digit decimal prior to being copied to the monthly worksheet. Data is first imported to a buffer worksheet where this data conversion occurs and then copied to the appropriate worksheet.

    Here is the strange thing that has me totally baffled, the column where I have a second group of expenses imported, always rounds the numbers and instead of appearing as say 54.4, it shows as 54.00, Were it 54.60 then it would be 55.00. This is prior to any conversion code.

    I have tried multiple things, one of which is after I completely clear the buffer sheet before the next import, I also convert the entire sheet to text, so 54.4 should show in that other column as 54.4, but instead shows as a rounded number of 54.00 . I then added a specific code to convert just that column to text prior to import, but the import still shows all numbers in that column as rounded.

    To add more confusion that has me baffled, the import works just find for sheets Jan thru May, but all imports for Jun thru Dec are rounded.

    All months use the same code with the only differences are the CSV files for a particular sheet. In trouble shooting I took the May csv file and renamed it to several other months after June, each import is rounded even though the csv file worked fine in May.

    One last thing, in troubleshooting, I also have deleted the Jun worksheet and recreated a new one, still the same problem occurs.

    Hopefully, I have described that well enough and you can understand my frustration and confusion. Does anyone have any ideas that I might look at or what may be causing such a strange problem.

    HELP?

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,366

    Re: HELP.. not sure what is happening, numbers being rounded

    What is the code? It sounds like perhaps you have used a Long or Integer variable by mistake.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    01-08-2017
    Location
    Salt Lake City, Ut.
    MS-Off Ver
    2019 and 365
    Posts
    135

    Re: HELP.. not sure what is happening, numbers being rounded

    There is no code or formulas on the buffer sheet that are coded, the imported sheets Jan through May all use the same code for importing, conversions, and copying to their appropriate sheets but work fine. Since I have renamed a known good CSV file to another month, such as June or July, and the problem of rounded numbers still occurs. I have placed breakpoints in the code immediately after the import prior to and conversion code being run, but the numbers already appear rounded.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,366

    Re: HELP.. not sure what is happening, numbers being rounded

    I suggest you post the code and the csv that doesn't work.

  5. #5
    Forum Contributor
    Join Date
    01-08-2017
    Location
    Salt Lake City, Ut.
    MS-Off Ver
    2019 and 365
    Posts
    135

    Re: HELP.. not sure what is happening, numbers being rounded

    The import code is as follows"

    Please Login or Register  to view this content.
    For some reason it is not allowing me to attach the csv. I will try that in another reply.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,366

    Re: HELP.. not sure what is happening, numbers being rounded

    Perhaps the column type in your query is wrong.

  7. #7
    Forum Contributor
    Join Date
    01-08-2017
    Location
    Salt Lake City, Ut.
    MS-Off Ver
    2019 and 365
    Posts
    135

    Re: HELP.. not sure what is happening, numbers being rounded

    that is something I will have to take a look at.. thanks for the suggestion.. will get back to you shortly. The only question I would have, is all queries were created that same way, I am not sure why some would work and others not, but I will check into it.

  8. #8
    Valued Forum Contributor
    Join Date
    08-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, Office 365
    Posts
    467

    Re: HELP.. not sure what is happening, numbers being rounded

    Hi dentler

    Just checking...
    ..if my worksheet has a custom format applied to the entire sheet
    0".00"
    ..then when I import data from a csv file, all imported numbers on that particular sheet are then displayed as rounded numbers like xxx.00
    (but each cell will show the correct full-decimal value in the formula bar)

    ..just trying to replicate the reported problem.

    zeddy

  9. #9
    Forum Contributor
    Join Date
    01-08-2017
    Location
    Salt Lake City, Ut.
    MS-Off Ver
    2019 and 365
    Posts
    135

    Re: HELP.. not sure what is happening, numbers being rounded

    Rorya, You nailed it. Although the column type was probably not the answer, when I first created the queries, there was no data in Jun thru Dec. Since I copied and renamed a know good CSV file for the months Jun thru Dec, I just deleted all the queries previously created for those months, and created new ones. It works now.

    Thank you so much. You have no idea how much time I have spent running around in circles trying to figure this out.

+ 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. Calculating Rounded Off Numbers
    By bins1863 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-17-2015, 07:06 AM
  2. The sum of numbers, Rounded to the next .05
    By mattio in forum Excel General
    Replies: 3
    Last Post: 12-12-2011, 06:48 PM
  3. How to mutliple rounded numbers
    By rphan in forum Excel General
    Replies: 5
    Last Post: 09-01-2011, 05:40 PM
  4. Summing Rounded Numbers
    By Ulysses in forum ExcelTip.com Feedback / Comments / Suggestions
    Replies: 1
    Last Post: 04-01-2007, 03:22 AM
  5. numbers being rounded
    By intemporal in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 01-04-2006, 05:44 PM
  6. how do i add rounded numbers?
    By echase in forum Excel General
    Replies: 4
    Last Post: 11-12-2005, 02:45 PM
  7. Rounded numbers and SUM
    By djarcadian in forum Excel General
    Replies: 5
    Last Post: 02-11-2005, 08:41 PM

Tags for this Thread

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