Dates & regional formats · 4 min read

Excel Changes Codes into Dates: Preserve the Column as Text

A part code, shelf label, or catalogue reference can resemble a date without representing a calendar event. Excel may interpret those characters during entry or CSV opening.

Decide that these values are identifiers

The field's purpose determines its type. In this example, 3-4 names an item; it is not March 4, April 3, a subtraction, or a fraction. Quantity is numeric because it is counted. Keeping the two columns different avoids forcing the whole file into one interpretation.

Record the code's exact spelling in the source system. Punctuation, leading zeros, and letter case can matter to another application even when two entries look similar to a person. Do not add spaces or remove punctuation merely to prevent Excel's date detection: that creates a different identifier.

TaskApproachReason
Type several new codesFormat the empty cells as Text firstPreserves typed characters.
Type one occasional codeUse Excel's leading apostrophe entry conventionStores the entry as text without a visible prefix.
Import a CSV repeatedlyGive the code column an explicit Text typeMakes the import rule repeatable.
Repair already changed valuesReload the unchanged sourceA date does not retain the original code spelling.
Send codes to another systemExport exact characters and specify text importCSV itself carries no cell-type rule.

Prevent conversion during manual entry

Select the empty code cells before typing. In Excel desktop, open Format Cells with Ctrl+1, choose Text, and confirm. Then enter 3-4, 12/2, and A-17. Keep the quantity column General or Number. A formula such as =ISTEXT(A2) should return TRUE for the code.

For an isolated entry, typing an apostrophe before the code is another Excel entry method. Enter '3-4 in the cell; Excel displays 3-4. This is an instruction to Excel during cell entry, not a general CSV escaping convention. Do not add apostrophes to the raw CSV unless the receiving system explicitly requires them.

Checks after importing the sample into A1:B4
C2: =ISTEXT(A2)        Expected: TRUE
D2: =LEN(A2)           Expected: 3
E2: =EXACT(A2,"3-4")   Expected: TRUE
The three-character item code 3-4 remains 3-4 when stored as text.
Illustrated example. Synthetic illustration: the desired result is the original code as text, regardless of the computer's date convention.

Import the CSV with an explicit code type

Use Data > Get Data > From File > From Text/CSV, then Transform Data. In the query editor, inspect the Applied Steps before loading. If a guessed type step already converted item_code, remove or edit that conversion and return to the original text values. Merely adding a Text step after the conversion preserves the converted date's text, not necessarily the original code.

Set item_code to Text and quantity to Whole Number, check the preview against the sample, and load the table. If you use the legacy Text Import Wizard instead, select the code column in its final data preview and choose Text. Menu availability differs by Excel version.

  1. Start from a preserved copy of the CSV.
  2. Inspect every code column, including columns that currently contain only digits.
  3. Load the typed result and compare the first, last, and date-like codes with the source.
  4. Save a workbook copy as XLSX if you need to retain workbook cell types.

Related help: Keep other identifier columns as text during import

Recover from the source, not the date display

Suppose a converted cell now displays a calendar date. Formatting it as Text may reveal a serial number or another representation of that date. Neither tells you whether the source was 3-4, 03-04, or another spelling that Excel accepted. A reconstruction formula would be guessing.

Return to the untouched export, source application, or a known-good version and repeat the import with Text selected. Keep the damaged workbook separately until record counts and identifiers agree. If no original remains, mark uncertain codes for review instead of presenting reconstructed values as verified.

A converted date cannot prove original punctuation or padding, while the original CSV retains the code 3-4.
Illustrated example. Synthetic workflow: the original CSV provides evidence for an exact code; the converted date alone does not.

Do not rely on a single global setting

Some current Excel versions expose Automatic Data Conversion options, including a control for continuous letter-and-number strings that resemble dates. That control does not justify assuming every slash or hyphen code is protected. An explicit Text import remains a clear rule for an identifier column across mixed data and different recipients.

Quoting 3-4 as a CSV field also does not declare a text data type: CSV quotes organize fields. After exporting, reopen a copy through the same controlled import route and compare exact values. The Column Harbor checker can flag selected risks in UTF-8 CSV; it cannot reverse Excel's earlier conversion or modify the workbook.

Common questions

Will changing the cell to Text restore my original code?

Only if the original text is still present. Once a code has become a numeric date, formatting alone cannot establish its original separators, padding, or spelling.

Should every column be Text?

Use Text for identifiers and other literal strings. Keep quantities and other fields intended for calculations numeric, with separate validation rules.

Does surrounding a CSV code with double quotes stop date conversion?

Do not rely on it. CSV quoting defines field boundaries and escaping, while the spreadsheet still decides how to interpret the field's content.

Sources & method

Examples and diagrams use synthetic data. Application instructions follow the linked documentation; available menus and options can vary. Our sample checks do not establish behavior in every Excel or Google Sheets version. Read our AI-assisted editorial method.

Browse all field guides →