Prevent Excel from Converting Entries Such as 4-1 into Dates
Question details
Prevent Excel from automatically changing entries such as 4-1, 4-2, 5-X, and 6-X into dates or other unintended values.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user is entering code-like values that include hyphens and needs the original characters preserved.
- Observed behavior
- Excel interprets values resembling dates, such as 4-1, as dates instead of retaining them as text.
Decide which column will contain the codes before entering or pasting data. Applying the Text format first is the most reliable way to preserve existing hyphens and characters.
Format the destination cells as Text before entering codes
Use this method when entering or pasting values such as 4-1 and 5-X into a new or empty range.
The Text number format tells Excel to treat every entry in the selected cells as text rather than attempting to recognize dates, numbers, or formulas.
In the worksheet, select the cells or the entire column where you will enter values such as 4-1 or 6-X.
Right-click the selected range and choose Format Cells, or press Ctrl+1.
On the Number tab, select Text and click OK.
Type or paste the codes into the formatted cells. Excel will retain entries such as 4-1 as text.

Disable automatic date conversion in Excel 365
Use this option when you want Excel 365 to stop automatically converting date-like text during data entry, pasting, or text import.
Use a leading apostrophe for individual entries
Use this quick workaround when only a few values must remain text and you cannot change the cell format first.
Keep Hyphenated Codes as Text in WPS Spreadsheets
WPS Spreadsheets lets you set a cell range to Text before entering or importing codes, helping values such as 4-1, 4-2, 5-X, and 6-X remain exactly as typed instead of being treated as dates.
- 1. Select the code column: Open the worksheet in WPS Spreadsheets and select the cells or column that will contain the codes.
- 2. Open cell formatting: Right-click the selection and choose Format Cells, or use the Home tab number-format controls.
- 3. Choose Text: In the Number category, select Text and confirm the formatting.
- 4. Enter the codes: Type or paste values such as 4-1 and 5-X into the formatted cells; they will remain text.

Frequently Asked Questions
Why does Excel change 4-1 into a date?
Excel uses automatic data recognition and may interpret a number-hyphen-number pattern as a date. Format the destination cells through Format Cells > Text before entering the value.
Can I restore 4-1 after Excel has converted it to a date?
Yes, but changing the cell format alone will not recover the original input. First set the cell to Text using Ctrl+1 > Text, then type or paste 4-1 again.
How can I paste a list of product codes without Excel changing them?
Select the destination column first, open Format Cells with Ctrl+1, choose Text, click OK, and then paste the list.
Does a leading apostrophe keep a value from becoming a date?
Yes. Enter '4-1 instead of 4-1. Excel stores it as text and normally displays the value as 4-1 without showing the apostrophe.
Where is the automatic date conversion setting in Excel 365?
Go to File > Options > Data and look under Automatic Data Conversion. Disable the setting that automatically converts entries into dates when that control is available in your Excel version.




