178

I'm trying to process some data in Excel. The data includes numeric account numbers and other long numeric strings (like cell phone MEIDs). I am not doing math operations on these strings, so I want Excel to treat them as plain text.

Here is what is making me nuts (this is Excel 2010):

  1. Take a long number like 1240800388917 and paste it in a cell in a new worksheet.
  2. Excel's default cell format is general, so the string is presented in scientific notation as 1.2408E+12
  3. Right click on the cell, select Format Cells, set the format to Text

The cell is still displayed in scientific notation, even though the format has been set to text.

Now, if I do the steps in a different order:

  1. Format an empty cell as text. Right click on the cell, select Format Cells, set the format to Text
  2. Take a long number like 1240800388917 and paste it in to the text formatted cell

Now, the cell is displayed as a string and not in scientific notation.

The results remaining in scientific notation even though the cell is formatted as text just seems broken to me. I've seen suggested work-arounds like: use CSV import and set the format to text, add a space character to the beginning of each numeric string, and others.

Is there a simple good work around to easily keep these strings formatted as text?

Why on earth does Excel do this?

Related SU questions I found: How can you make Excel 2007 stop formatting large numbers as scientific notation? and Is this Excel behaviour with a large hex number expected?

Raystafarian
  • 21,963
  • 12
  • 64
  • 91
Michael Levy
  • 2,090
  • 6
  • 18
  • 22

14 Answers14

251

This worked for me in Excel 2010. Just select the column, right click, Format cells, Custom and choose the option that says 0 (second option below General).

Anonymous
  • 2,559
35

Ah, memories of data munging back from when I did some massive number cross checking in Excel (never again).. When you punch in long numeric strings into Excel, try say, 12345678901234567890 (20 digits), Excel will generally convert it for you, meaning that the 20 digit number you've just tapped in has been cut back to be only about fifteen significant figures.

Note as well: the conversion is a truncation, as opposed to rounding. (12345678901234567890 is 1.23456789012346E+19, but excel will show you 1.23456789012345E+19)

This occurs at point of entry, so once it's in, any additional detail is lost, and so even if you tell Excel that you really meant that was text, and not a number, you're kind of out of luck, and hence why your first sequence doesn't work.

tanantish
  • 1,257
  • 9
  • 12
18

Try this... this works for me, Excel 2013.

=""&a1

where a1 holds the numeric value. After, copy the column and paste to original column.

gronostaj
  • 58,482
Rok
  • 321
16

I found that in Office 2010, if you format the column first, and then paste in the data, it will show the large numbers correctly.

M Akin
  • 261
14

A single apostrophe ' before a number will force Excel to treat a number as text (including a default left align). And if you have errors flagged, it will show as a number stored as text error on the cell.

dav
  • 10,618
12

I'm aware of the age of the question, but this is the one I've landed after google search and which did not answered my question (why formatting as text doesn't work and why number is cut down to 15 digits after format to text).

Short answer is: you can't work on your number the way you like AFTER you entered the numeric value and tapped Enter. The moment you do that the number will be truncated to 15 digits and presented in as exponential.

This is not a bug, it's a feature.

Why is it happening is rather simple and this here answer delivers it nicely.

So what happens is that Excel autodetects type of input and if it's a number then it has precision limit of 15 digits and, if cell is formatted with 'General' format, it's displayed as exponential if value has 12 digits or more.

I believe it has to do with shell integration of Excel with '.CSV' files - in order for Excel to open them properly, assumptions have to be made. It is how Excel works for as long as I'm using it - that is: since 2001 at least.

Anything you do after that will be using the truncated value, so no formatting trick will help. However, you can use the Text to columns option to convert exponential notation to text (Click on column header, click Text to data, then Delimited, Next, untick all delimiter boxes, Select Text in Column data format and then Finish) to have the values converted to text and immediately displayed as 15 digit number. But, it will be only 15 digits, so if you had longer number, rest is "lost" to precision limit.

In order to have the number in the spreadsheet exactly the way you typed it in you have to store it as text. So you have two ways of doing that, but they will work only BEFORE/DURING editing:

  1. you need to precede it with apostrophe or format cells as text before typing/copying values into it,

  2. you have to format the target column as Text before input.

If you're using method 1 and it "sometimes doesn't work", then, sorry, you either do something wrong or you have some sort of autocorrect on (if you use apostrophe and large number >15 digits Excel treats it as a wrong value and flags cell with warning message, so this remark is not personal nor critique).

Method 2 is very useful, because it works with copy&paste, even with large datasets.

Other way to do it in bulk numbers is to import values from text file. I dare say it's the only way for most situations. And be sure to import the file, not just open it, as Excel treats csv type like it's native format and trims large numbers to 15 digits as a matter of course.

Now, to the last issue. If you enter large numerical value in Excel cell formatted as text it will still be displayed in scientific notation as long as the cell is not wide enough. It's annoying, but side effect of some Excel internal algorithms. Just make the cell wider and you'll see full value every time.

AcePL
  • 1,919
4

Excel 2010: This works one column at a time and not at all for a row. Select the column or subset of a column, from the Data tab select "Text to Columns", and jump right to "Finish." No more scientific notation.

I agree with the many Excel users, it's criminal that there is no option to prevent scientific notation!

4

You can format cells as Custom > #

This can be applied after you paste the data into the column, but you must do it before you save the spreadsheet.

I work a lot with barcodes (UPC's) and excel will format them as scientific notation by default. Drives me nuts! Why this isn't an option I'll never know.

Graham
  • 49
3

Excel is frustrating for CSV/bulk data work like this. Work with LibreOffice if possible, it doesn't do this, that is, if you open the same sheet (.xlsx) in Libreoffice, the large 'numbers' which are actually strings are not displayed in scientific notation (which is an absurd decision by Excel). LibreOffice's file fidelity is great: open the same .xlsx in Excel again, and the scientific notation instantly "works" just like usual.

1

As mentioned in other posts, Excel overwrites the data you pasted with the scientific notation, so there's no way to go back no matter what you change the format to.

The way I deal with this is I always first paste all the data into excel and note all the columns that have scientific notation. Then I undo the paste, highlight all the columns I noted before (Ctrl-Click) and change format to text. After that I re-paste and all the scientific notations disappear.

1

In Excel 2013, the same thing happened to me and I just went to Format Cells -> Number then made sure the decimal place is set to "0".

0

Select all the cells — or, to make things easy — select the entire spreadsheet and click Format Cells, then Text.

Automatically, your whole spreadsheet will use text. You don't have to do it cell by cell.

slhck
  • 235,242
Dima
  • 300
0
  1. Copy/paste problem field into new sheet in column A

  2. Copy/paste Column A into text file

  3. Format Column B to text and paste text file into Column B

  4. In Column C:

    =IF(ISNUMBER(SEARCH("+",B1)),A1,"")
    
  5. Convert Column C into a number format with no decimals

  6. Copy/paste Column C into text file

  7. Format Column D into text and paste text file to Column D

  8. In Column E:

    =IF(IF(IF(B2=A2,A2,D2)=0,A2,IF(B2=A2,A2,D2))=0,"",IF(IF(B2=A2,A2,D2)=0,A2,IF(B2=A2,A2,D2)))
    
  9. Copy/paste Column E into notepad

  10. Delete data in problem field and format column to text

  11. Copy/paste data from text file to problem field

nixda
  • 27,634
0

This worked for me in Excel 2013, including copy-pasting the cells out to other programs. Filtering the data helped, especially for the edit steps.

  1. Select your desired cell(s).
  2. Apply the Number Format "Text". (Try Alt, H, N, then "Text".)

Then, for each of your desired cells:

  1. Enter edit mode. (Try F2.)
  2. Confirm your edit with either Enter (good for columns) or Tab (good for rows). Do not alter the contents.

Your number will appear normally, even at 100 digits. =)

nikodaemus
  • 2,883