Why Excel converts numbers to dates and how to prevent it
Excel treats certain number patterns as dates and converts them automatically. Type 1-2 and Excel reads it as January 2nd. Type 3/4/5 and it becomes March 4th, 2005. This happens because Excel's default cell format is set to recognize date patterns, and it applies that format the moment you press Enter.
The conversion happens before you see it. You type the number, Excel reformats the cell, and what displays is a date. The underlying value is still a number — Excel just changed how it shows that number to you. This matters because the number 45000 and the date 5/15/2023 are the same thing to Excel; dates are stored as numbers counting days since January 1, 1900.
You can stop this in three ways: format the cell before you type, tell Excel to treat the input as text, or undo the conversion after it happens. Which one you use depends on whether you're fixing one cell, a whole column, or data you've already entered.
Key Takeaways
- Excel converts number patterns like 1-2, 3/4/5, and 12-34 to dates because the cell format is set to recognize dates, not because the numbers themselves are wrong.
- Format cells as Text or Number before typing to prevent conversion, or type an apostrophe (') before the number to force it to stay as text.
- If conversion already happened, select the cells, use Find & Replace to remove hyphens or slashes, then change the format back to Number.
- Dates and numbers are the same thing in Excel — dates are just numbers displayed differently — so converting back does not lose information.
Format the cell before you type
The fastest way to stop conversion is to set the cell format first. Right-click the cell or column where you'll type, select Format Cells, and choose Number or Text from the Category list. Click OK. Now type your number — Excel will not convert it.
Use Number if you need to do math with the values later. Use Text if the number is a code or identifier that should never be calculated. For a column of product codes like 1-2-3 or 3/4/5, Text is usually the right choice because you do not add or multiply product codes.
If you're working with a whole column, click the column header to select the entire column, then format it. Every cell in that column will now reject date conversion. This is the best approach if you're about to paste in a list of numbers or codes.
Use an apostrophe to force text format on one entry
If you've already started typing and realize a number will convert, type an apostrophe (') at the very beginning: '1-2 or '3/4/5. The apostrophe tells Excel to treat everything after it as text. Press Enter, and the number stays as you typed it. The apostrophe itself does not display — it's an instruction to Excel.
This works for single entries and is faster than formatting if you only have a few problem cells. It also works if you're pasting data: paste the data, then use Find & Replace to add an apostrophe to the beginning of every cell in that range. Open Find & Replace (Ctrl+H on Windows, Cmd+H on Mac), leave the Find field empty, type ' in the Replace field, and click Replace All.
Fix numbers that already converted to dates
If Excel already converted your numbers, the cells now show dates instead of the original numbers. The data is still recoverable because dates and numbers are the same thing in Excel — the date is just a different way of displaying the number.
Select the cells that converted. Open Find & Replace (Ctrl+H or Cmd+H). In the Find field, type / (the forward slash). Leave the Replace field empty. Click Replace All. This removes the slashes that Excel added when it formatted the numbers as dates. The cells now show numbers again, but they may still be formatted as dates.
Right-click the selected cells, choose Format Cells, and change the Category to Number. Click OK. The numbers now display correctly and the cell format matches what you actually have. If your original numbers had hyphens instead of slashes, search for and remove hyphens the same way.
When to use Text format versus Number format
Choose Text for codes, IDs, and identifiers: product codes, ZIP codes, phone numbers, part numbers, or anything you'll never add or subtract. Text format prevents Excel from doing any math with the values, which is what you want. A ZIP code is not a number in the mathematical sense — it's a label that happens to be made of digits.
Choose Number for actual quantities and measurements: counts, prices, measurements, or anything you might calculate with later. If you format as Text, Excel will refuse to add or average those values, and you'll have to convert them back to Number format before you can use them in formulas.
The difference matters most when you're building a spreadsheet you'll use for months. Formatting correctly at the start saves you from discovering later that a column you thought was numbers is actually text, and your SUM formula returns zero.
Paste special as text to import data without conversion
If you're copying numbers from another source — a website, an email, another spreadsheet — paste them as text to skip conversion entirely. Copy the data from the source. In Excel, right-click the cell where you want to paste and select Paste Special. Choose Text from the options and click OK.
This tells Excel to treat everything you're pasting as text, regardless of what it looks like. The numbers stay exactly as they were in the source. You can then format the cells as Number if you need to do math, or leave them as Text if they're codes or identifiers.
Paste Special is also useful if you're pasting from a formatted source like a website table. It strips away all formatting and gives you just the raw text, which you can then format the way you want in Excel.
Prevent conversion when importing from other programs
If you're importing data from another program — a database export, a CSV file, or a report — Excel often converts numbers during the import. The safest approach is to open the file as Text format first, then let Excel's import wizard handle the conversion.
Open Excel. Go to File > Open. Find your file and select it. Before clicking Open, look for a button or option that says Open as Text or Import. This launches the Text Import Wizard, which shows you a preview of the data and lets you set the format for each column before the data enters Excel. Set problem columns to Text format in the wizard, and the conversion will not happen.
If you've already imported the data and it converted, use the Find & Replace method described above to remove the date formatting characters, then reformat the cells as Number or Text.
Frequently Asked Questions
Why does Excel think 1-2 is a date?
Excel recognizes date patterns like month-day, month/day/year, and day-month based on your computer's regional settings. The pattern 1-2 looks like January 2nd, so Excel converts it. This is a feature meant to help with date entry, but it interferes with number codes and identifiers that happen to use hyphens or slashes.
Can I undo a conversion that already happened?
Yes. Use Find & Replace to remove the slashes or hyphens Excel added, then reformat the cells as Number. The original number is still there — Excel just changed how it displays. You can also press Ctrl+Z when ready after typing if you catch the conversion right away.
What's the difference between formatting as Text and using an apostrophe?
Formatting the cell as Text prevents conversion for anything you type in that cell going forward. Using an apostrophe (') is a one-time instruction for that single entry. Both produce the same result, but formatting is better if you're entering many values in the same column.
Will reformatting a date back to a number lose information?
No. Dates and numbers are the same thing in Excel — a date is just a number displayed with date formatting. Changing the format back to Number shows the underlying number, but no information is lost. You can always reformat it as a date again if you need to.
How do I stop conversion when pasting data from a website?
Use Paste Special and choose Text. This pastes the raw data without any formatting, so Excel cannot convert it. You can then format the cells the way you want. Alternatively, format the cells as Text before you paste, and conversion will not happen.