File Format & Compatibility

Prevent Excel from Converting Entries Such as 4-1 into Dates

Nimra MalikNimra Malik Nov 12, 2026 869 views

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.

Prevent Excel from Converting Entries Such as 4-1 into Dates
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the target cells or column

In the worksheet, select the cells or the entire column where you will enter values such as 4-1 or 6-X.

2
Open the Format Cells dialog

Right-click the selected range and choose Format Cells, or press Ctrl+1.

3
Apply the Text format

On the Number tab, select Text and click OK.

4
Enter or paste the values

Type or paste the codes into the formatted cells. Excel will retain entries such as 4-1 as text.

Format the destination cells as Text before entering codes
Existing converted dates: Changing the format after Excel has already converted an entry does not restore the original code. Re-enter the original value after applying the Text format.
WPS Spreadsheets

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. 1. Select the code column: Open the worksheet in WPS Spreadsheets and select the cells or column that will contain the codes.
  2. 2. Open cell formatting: Right-click the selection and choose Format Cells, or use the Home tab number-format controls.
  3. 3. Choose Text: In the Number category, select Text and confirm the formatting.
  4. 4. Enter the codes: Type or paste values such as 4-1 and 5-X into the formatted cells; they will remain text.
Set a destination column to Text to preserve hyphenated codes.Open and edit Microsoft Excel .xlsx and .xls files with compatible formatting.Use a familiar spreadsheet interface for data entry and number formatting.Enter an apostrophe before a one-off code to force text storage.
microsoft office alternative - wps office

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.