The Computer Oracle

How do I stop Excel from converting value 0503E000 to 5.03E+02 automatically?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Light Drops

--

Chapters
00:00 How Do I Stop Excel From Converting Value 0503e000 To 5.03e+02 Automatically?
00:30 Answer 1 Score 37
01:11 Accepted Answer Score 17
01:43 Answer 3 Score 11
02:15 Answer 4 Score 2
02:42 Answer 5 Score 0
03:02 Thank you

--

Full question
https://superuser.com/questions/861964/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#microsoftexcel #csv #xls

#avk47



ANSWER 1

Score 37


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:

Value,0503E000,1234123412341234

Or even this format:

Value,"0503E000","1234123412341234"

Converting it to:

Value  |  5.03E+02  |  1234123412341230

However, adding the equals sign forces Excel to begrudgingly preserve your data:

Value,="0503E000",="1234123412341234"

…which opens as:

Value  |  0503E000  |  1234123412341234



ACCEPTED ANSWER

Score 17


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.




ANSWER 3

Score 11


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.




ANSWER 4

Score 2


Start the cell with an apostrophe to force text interpretation:

'0502E000

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.




ANSWER 5

Score 0


Try to load the file (data fetched from DB table) through DATA option in MS excel then simply while loading just select “Do not detect data types” under “Data Type Detection” then load , this will keep the as it as format of data and loads excel, no need for any column conversions.