Home > front end >  Txt document data doesn't format correctly in Excel
Txt document data doesn't format correctly in Excel

Time:12-14

Disclaimer - this should be a very simple task, but clearly everything I thought I knew about excel is false.

I'm trying to copy and paste data from a txt document to an excel document. An example of a line I'm trying to copy from the txt doc is: 4512544425701264.

However, when I paste into excel it pastes as 4512544425701260 but displays in the cell as 4.51254E 15. This happens for each line of data.

I've tried numerous ways to fix this problem none have worked including:

  • Copied the txt data into a Microsoft Word document, then tried pasting into the excel.
  • Resized the cell.
  • Tried each cell formatting option.
  • Tried opening the txt doc in Excel, even progressed through the text import wizard. Interestingly, I noticed the data preview on page 3 displayed the data correctly. But after proceeding past the importer, the data loaded with the same problem.
  • Tried on another PC.
  • Copied and pasting one line at a time.

The only solution I have found is manually typing out each line, however this is highly unpractical due to the large amount of data.

Any help/advice would be greatly appreciated.

CodePudding user response:

When you paste into Excel, try calling "Text import wizard" in the Paste Options. This will allow you to set delimiter (in case of CSV) and later data type of a column where you can select "Text" which will tell wizard not try to convert your data into numbers.

CodePudding user response:

To show full number rightclick on cell, choose "Format cells..". In "Number" tab choose "Number" category and set "Decimal places" to zero.

Unfortunately excel lets to put only 15 digits as a number. Every additional number is converted to 0, that is why your number 4512544425701264 is converted to 4512544425701260

If you don't need this number to be used in calculation, you can format cells to text format before pasting:

enter image description here

Source on digits limitation: enter image description here

You could also do like this:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

  • Related