How to Stop Excel from Converting Numbers and Codes to Dates
Question details
User needs to prevent Excel from automatically interpreting and converting specific number formats or hyphenated codes into date values.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Entering numerical codes, part numbers, or fractions that resemble dates into a spreadsheet.
- Observed behavior
- Excel automatically changes the entered code (such as 6-9240) into a date format, even if the cell is formatted as Number or General.
Before re-entering your data, ensure you select the target cells and clear any existing date formatting to prevent the issue from reoccurring.
Format Cells as Text Before Entering Data
Applying the Text format to your cells beforehand tells Excel to treat any entered values exactly as typed, disabling automatic date conversion.
By default, Excel cells are formatted as 'General', which allows the software to guess the data type. Pre-formatting as Text forces Excel to read the input literally.
Highlight the column, row, or specific range of cells where you plan to enter your codes or fractions.
Navigate to the 'Home' tab on the ribbon menu and locate the 'Number' group.
Click the format dropdown menu (which usually displays 'General' by default) and scroll to the bottom to select 'Text'.
Type your code (e.g., 6-9240) into the newly formatted cell. Excel will now keep the exact characters without converting them to a date.

Add an Apostrophe Before the Code
A quick, on-the-fly workaround for entering a few codes without needing to change the overall cell formatting properties.
Use WPS Spreadsheet to Manage Data Without Formatting Errors
WPS Office offers a powerful spreadsheet tool that provides precise control over cell formatting. You can easily stop automatic date conversions and handle large datasets effectively while maintaining exactly what you type.
- 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook in the Spreadsheet module.
- 2. Select your data range: Highlight the cells, rows, or columns where you will enter the hyphenated codes.
- 3. Open Format Cells dialog: Right-click the selected area and choose 'Format Cells', or use the keyboard shortcut Ctrl+1.
- 4. Apply Text formatting: Under the 'Number' tab, click on 'Text' in the category list and click 'OK'.
- 5. Input data securely: Enter your codes safely knowing WPS Spreadsheet will preserve your exact input without auto-formatting to dates.

Frequently Asked Questions
Why does Excel convert my numbers to dates automatically?
Excel is programmed to recognize common date patterns (like fractions, month-year combinations, or hyphenated numbers) to make data entry faster for users who are actually entering dates. This aggressive auto-formatting can inadvertently convert non-date items like part numbers or codes.
Can I turn off auto-date conversion globally in Excel settings?
In newer versions of Excel, you can disable some automatic data conversions. Go to File > Options > Data, and look for 'Automatic Data Conversion' settings to uncheck converting numbers to dates. In older versions, this global setting is not available, and you must use the Text format or apostrophe method.
How do I fix a code that has already been converted to a date?
Once Excel converts a code to a date, the original text data is lost in the background. Changing the cell format back to Text will only show a 5-digit date serial number (e.g., 43831). You must delete the incorrect date, format the cell as Text, and retype the original code.




