Excel converting value 0503E000 to 5.03E+02 in any cell automatically in CSV I tried to convert it to text number and general but after i save it and reopen it again it goes back to 5.03E+02
How do I stop this from happening?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
I think the key issue here is that you are using a CSV, which does not have the cell type embedded in it. Excel automatically tries to interpret the cell as having a scientific number which is why you are seeing 5.03E+02 instead of 0503E000.
Try creating an Excel workbook and formatting all of the cells as text, and then pasting in the data. I tried it in Excel 2013 and it worked.
If you can convert or control the CSV format, you can force a column to parse as text in Excel by wrapping it in double quotes and prepending an equals sign.
Excel will carelessly discard precision in this format:
Or even this format:
Converting it to:
Value | 5.03E+02 | 1234123412341230
However, adding the equals sign forces Excel to begrudgingly preserve your data:
…which opens as:
Value | 0503E000 | 1234123412341234
Instead of Opening" the CSV file in Excel, select to Import the file (in Excel 2007-2010 you would navigate to the Data Ribbon / Get External Data / From Text). Not sure about 2013 but there should be something similar. When you do that, the Text Import wizard will open and afford you the opportunity to format the column containing that Value as Text, before Excel (not so helpfully) changes it to a numeric value.
Start the cell with an apostrophe to force text interpretation:
Basically, this tells Excel not to parse the field as a number. Because there is an 'E' in the field, it looks like a number to Excel. The apostrophe won't actually be entered into the cell:
[a1] '0502E000 [b1] =hex2dec(a1)
Cell 'b1' will display 84074496.
With the default cell formatting, numbers with a zero in front and long numbers will automatically get modified by Excel. For example, if you type 012, it will be changed to 12.
If you format the cells as Text, then any number that you type in the cell will stay as is, and will not be modified by Excel.
However, if you paste a number from another source into a cell that is formatted as Text, and in the source there is any sort of formatting, the formatting of the cell will change from Text to General, and the number manipulation will come back.
The solution that I found was to do a paste special, and paste the number as Text. Then the cell remains with its Text formatting, and the number is not modified at all.