Opening a CSV by double-clicking lets Excel guess each column type, and a postcode such as 02134 becomes the number 2134 with the zero gone. Importing through the Text Import wizard and setting the postcode column to Text keeps every code intact.
Prerequisites
- Excel
- The CSV file
- A copy of the source file, so the original stays untouched.
Steps
- Do not double-click the CSV. In Excel, go to Data, Get Data, From File, From Text/CSV.
- In the preview, select the postcode column and set its data type to Text.
- Load the data, then check the postcode lengths with a LEN column and compare them with the source.
- If any postcode is short, re-import the file rather than adding zeros by hand.
- Save the imported file as .xlsx so the text format is kept.
Worked example: Fictional customer postcodes kept as text
The practice table below is a fictional five-customer postcode list. The length column is the character count of each postcode, and the total is their sum. The table below is fictional practice material, with fictional values. It is the expected result, worked out by hand, not a run of any tool.
| Customer | Postcode | Length |
|---|---|---|
| Amara | 02134 | 5 |
| Ben | 10027 | 5 |
| Clara | 90210 | 5 |
| Dev | 30301 | 5 |
| Elena | 60614 | 5 |
| Total | 25 |
Expected result. Five postcodes, each 5 characters long, and the lengths add to 25.
Limits
- A postcode column formatted as Text after opening will not restore zeros already lost; re-import instead.
- Postcodes are identifiers, never numbers, so never sum or average the column.
