How to stop Excel from Auto-formatting and making it work like a number crunching program
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: Ocean Floor
--
Chapters
00:00 How To Stop Excel From Auto-Formatting And Making It Work Like A Number Crunching Program
01:10 Accepted Answer Score 26
01:42 Answer 2 Score 16
02:24 Answer 3 Score 5
02:51 Answer 4 Score 3
04:16 Answer 5 Score 1
04:56 Thank you
--
Full question
https://superuser.com/questions/330291/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#microsoftexcel #microsoftexcel2007 #formatting
#avk47
ACCEPTED ANSWER
Score 26
You need to specify in the csv file that it is text. You do this by putting your number in quotes and preceeding with and equal sign, eg:
="001145",="55666",="02133"
The easiest way to do this would be to do a find-replace on ,
with ",="
, replacing end of lines (you might need to use an advanced editor like Notepad++ for this) with "\r\n="
and doing the start and end of the file manually.
ANSWER 2
Score 16
- Change the file extension from ".csv" to ".txt" on the file you are having problems with.
- Open excel by itself. Don't click on the file to open it.
- Click "Open", change the file types to look for from "All Excel Files" to "All Files"
- Find your file and click open. Since Excel doesn't auto format txt, it will then take you thru the wizard.
- Makes sure the "Delimited" radio button is selected. Click the "next" button.
- Check the "comma" delimiter box and keep hitting the "next" button until you SEE (but don't click on it) the finish button.
- scroll thru each column in the spreadsheet, highlight each column(s) you want to manually format and change the format to "text".
- Click the finish button.
ANSWER 3
Score 5
Install OpenOffice from Oracle and do the same with OpenOffice's CSV format and it works.
I've had this problem in Windows 7 Pro with Excel 2010. I used to be able to copy Outlook contacts to Excel, save as CSV and import to Gmail and Android (the mobile numbers with leading zeros and + signs).
ANSWER 4
Score 3
To add to @Jon's answer from this question, I had a CSV file that had several columns that had leading zeros and longer numbers that would either lose the leading zero or convert the long number to scientific notation, or both, when imported.
The only way I could fix was to first format all of the cells in the empty sheet to Text
, by using the following steps:
- Select all the cells in the sheet:
- Change the format of every cell:
After formatting all of the sheet cells to be Text
, then I could import the CSV using the following steps:
- From the
Data
tab, clickFrom Text
:
Select your
.txt
or.csv
file and clickImport
Select
Delimited
and click `Next:
- Select the appropriate delimiter (I chose
Comma
) and deselect any others that don't apply, then clickNext
:
- Scroll to the right to find the column(s) that need(s) to be formatted as
Text
to retain leading zeros and to prevent scientific notation. Click the column (it should darken), then selectText
in the option list. Be sure to select all columns that need to be correctly formatted:
- Then click
Finish
. If you scroll to the columns that you formatted, you'll see that all leading zeros are retained and that long strings of numbers are not in scientific notation.
Hope that helps!
ANSWER 5
Score 1
Right-click on the cells containing your data, and click on the Format cells... menu entry. Then, in the first tab ("Number"), change the category from General to Text. This will prevent Excel from automatically formatting those cells as numbers, and thus removing the leading zeroes (which are meaningless in the context of numerical analysis, but very meaningful when dealing with product IDs).
If the data is being imported and parsed as numbers, you need to use the Data Import wizard, and set each column type to "Text" instead of "General". Then, do the same thing with the cells, and then save your Excel workbook.