We help IT Professionals succeed at work.

formatting column as text

zachvaldez
zachvaldez asked
on
I have a column upc which is displayed in scientific notation but I’d like to format as text by placing an apostrophe before the first character so it left aligned
Comment
Watch Question

Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:

You could just do a custom numeric format on that column, with something like "000000000009", that would be the simplest.


Or you could could create a text version in another column using a formula like =TEXT(A2,"000000000009"), and if desired then copy by value back to the original column.


If you really do want to change the existing cells to text with no formatting changes, or copying of cells, then you would need a VBA macro to do that, but that feels like more work / complexity than needed.

Shaun KlineLead Software Engineer

Commented:
You can use the "Text to Columns" option on the Data tab to change the number to text. Select the column you want displayed as text. Then click the "Text to Columns" option. Select "Delimited" for Step 1, unselect all delimiters on Step 2, and finally select "Text" on Step 3.

If you are doing it

... so it left aligned

Then why not simply change the cell alignment to left?

Author

Commented:

Shaune, your suggestion work for that moment, it does look right but when I save the file back as CSV(because that is the original format) and open the file again, UPC column is back to scientific notation look.

Lead Software Engineer
Commented:
Unfortunately, Excel displays large numbers in scientific notation. If you open up the CSV in a text editor, such as Notepad, the numbers should appear completely.

So the question then becomes, do you need the number column to display in Excel completely, or just be in the CSV file correctly? If it is Excel, you may need to make the change from where the file is created, if the file is created repeatedly. Some programs will add the apostrophe to designate numbers as text during an export process.

Author

Commented:

thanks Sqib, That will only be good in screen . Save it and open it, it's back to original.