Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent comma-separated list of numbers being interpreted as single large value

Tags:

excel

vba

33266500,332665100,332665200,332665300 was the original value, cell should look like this: 33266500,332665100,332665200,332665300 but what I see as the cell value in excel is 3.32665E+34

So the question is I want to convert it into the original string. I have found format function on google and I used it like these

format(3.32665E+34,"standard")

giving it as 332,6650,033,266,510,000,000,000

How to parse it or get back the orginal string? I belive format is the function in vba.

like image 591
niko Avatar asked Sep 23 '11 07:09

niko


People also ask

What is a comma separated list of values?

A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of the comma as a field separator is the source of the name for this file format.

How do I separate Comma Separated Values in CSV?

Adding "sep=;" or "sep=," to the CSV When you have a CSV that is separated by semicolons (;) and your system/Excel default is commas (,), you can add a single line to tell Excel what delimiter to use when opening the file. To do this: Open your CSV using a text editor.


1 Answers

Excel has a 15 digit precision limit. If the numbers are already shown like this when you access the file, there is no way to get the number back - you have already lost some digits. VBA code and formulas will not help you.

If this is not the case, you can add a single quote ' mark before the number to store it as text. This will ensure Excel does not try to treat it as a number and thus lose precision.

like image 180
aevanko Avatar answered Nov 03 '22 00:11

aevanko