Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Displaying long numbers (greater than 15 char) in Excel

Apr 23, 2008 11:33PM PDT

I work for a large processing house that produces thousands of reports every day that go out to many different users. Our standard for delivering reports is as CSV files to prevent the data from being truncated by Excel. While we send the files as CSVs, most of our end users open the files with Excel for easier viewing and data manipulation purposes.

A problem has arisen because our new transaction processing system uses a 32 bit numeric entry to uniquely identify the transaction. The field in CSV is properly filled in, but when the end users open up the CSV, the numbers are automatically translated into numeric, any digit beyond 15 is replaced by a "0", and then this modified number is translated into scientific notation. Now the data in the field is not only formatted in an illegible fashion, but the data itself has been converted wrong so even reformatting does not fix the problem.

Microsoft says that this is a feature of Excel is that numbers must conform to IEEE 757 standards of 15 characters or less, any digit beyond 15 is replaced by "0", and all other numbers must be treated as TEXT.

I need to find a way to change a setting in Excel, or the Excel registry so that numbers are automatically imported as strings of text instead of numbers. The solution must allow my end users to automatically open a CSV in Excel, and have the data display properly. I am aware that the users could manually import the information into Excel, but this is not something these people are going to be able to do on a regular basis.

Has anyone ever dealt with this before?


Thank you,

Discussion is locked

- Collapse -
Make them text.
Apr 23, 2008 11:46PM PDT

In other words, put quotes around them. Strings aren't converted or truncated, but stay as they are (at least up to 255 characters).

12345678901234567890123456789012 is truncated. "12345678901234567890123456789012" stays as it is, just like "1600 Pennsylvania Avenue, Washingon DC".

Any of your people importing any numbers they want to do calculations with, wouldn't really appreciate a global setting to treat all numbers as digits. While the above change only effects this one field is this one report.

Your statement 'The field in CSV is properly filled in" seems to contradict your other statement that "that numbers must conform to IEEE 757 standards of 15 characters or less". Using 32 digits is improper then.

Hope this helps.


Kees

- Collapse -
Quotes as a solution
Apr 23, 2008 11:58PM PDT

The quotes do work (I tried that one already), but the end users are looking for "a better" solution. A single quote at the begining of the string of numbers "'" also works, but once again the end users have been complaining that they can not simply copy and paste the contents of the cell into a different application becaue of the additional quote(s).

Anyone have any other things I could try?

- Collapse -
Sorry, wrong answer.
Apr 24, 2008 12:12AM PDT

I tested it myself now, and a 32-digit string is converted into a number like 1.23457E+17 automatically.

The workaround then (proven to work in Excel XP):
- rename the file to .txt
- in Excel, use File>Open to open it, this will call the text import wizard
- after answering a few questions about format (delimited) and separator (,) you'll reach the screen where you can specify the format for each column. If you specify text for the column with these long numbers they won't be converted and still look like a 32-digit number.

Kees

- Collapse -
Avoiding the Import Wizard
Apr 24, 2008 12:25AM PDT

This works too.

Do you know if there is any way to get excel to automatically save these import settings so that the users do not have to go through all of these steps to open the report? What they want is to simply double click on the report that is emailed to them, and for it to open in excel with the numbers properly formated.

Does this make sence?

I am not trying to be a pain. I am simply trying to convey the complexity of what I am trying to do.

- Collapse -
Would an Excel macro do it?
Apr 24, 2008 3:00AM PDT

If you had an Excel Workbook where the first spreadsheet included a macro that automated these procedures, you could let each of those people have that workbook. It would then import the numbers and set them wherever else in the same workbook they are supposed to go.

Although I have some knowledge of Excel macro and VB code, my knowledge is limited and I do not know how to code it to open the txt file and import the numbers.

I'm sure it could be done though. A project for you or someone else?

Mark

- Collapse -
Re: import settings
Apr 24, 2008 4:22AM PDT

To save import settings, you need MS Access. As far as I know Excel doesn't do it; that wouldn't be locigal indeed, because it's coming into a new workbook.

If you can format the number like, for example,
1234567890123456-7890123456789012, it's automatically recognized as text. Or any other format you like with at least one non-digit. But only digits is - by default - becoming a number.

The alternative would be to send it as, say, html or xml or pdf or rtf, so it opens in another application. In principle, it can be formatted nicely. Nothing in your posts until now shows the necessity for calculations to be done with the data.
Or make it available in any format you like via the company portal. That way, all necessary processing can be done automatically before any user sees it.

The basic problem, of course, is that Excel is originally a calculation oriented application. So it's understandable it does do something special with numbers that html or xml or pdf or rtf don't. Excel just isn't the 100% right tool to choose.

Kees

- Collapse -
Great advice
Apr 24, 2008 9:06PM PDT

I would prefer if our end users used anything other than Excel for these things, but Excel is all they know. I really like your idea of doing the formating my self and posting it on our internal portal. That will allow me to controll everything, and then the user still has the ease of just clicking on a link.

Thank you,

- Collapse -
Or ...
Apr 24, 2008 8:19PM PDT

do some server-side processing and don't e-mail the .csv-file, but a nice .xls file, all formatted and ready to go. Easy to do, and I'm sure your company has either the necessary compentence in-house or the money to hire it.

Kees

- Collapse -
Easy
Nov 15, 2013 2:52AM PST

Like the last post says, deliver an excel file instead of the CSV

Inside excel it can be done something so easy as this: Concatenate the number with "" (nothing) and it will convert it to string.

A
1- VeryLongNumber
2- 1.02E+15
3- 1.02E+15
4- 1.02E+15

B
1- Formula
2- =""&B3
3- =""&B4
4- =""&B5

C
1- Result
2- 1020000008630900
3- 1020000008625710
4- 1020000008625700

- Collapse -
Make excel format 20 digit number according to my wishes.
Sep 6, 2015 4:26AM PDT

Similar to above discussion, my problem is thus:

I want to type two mobile numbers in one cell of the excel with this cell/display format: #####-#####, #####-##### (means one hyphen after every 5 digits).

But it keeps changing the last 4 digits into zeros.
Is it possible in any way?

- Collapse -
Tip: Avoid such old posts. Make a new one.
Sep 6, 2015 8:51AM PDT

Otherwise folk may not read a new help request.

- Collapse -
Tip: don't trust Excel. Type the dots yourself.
Sep 6, 2015 9:04AM PDT

You're not going to do calculations with them, are you? So there is no need for it to be a number.

Kees