Sub topic 16
Converting text to numbers and dates
This chapter assumes you know that a cell holds a stored value and a display format, and that dates are serial numbers. It also assumes you can write a basic formula. Here you will learn why Excel sometimes keeps numbers and dates as text, how to spot it, and how to convert them.
Why text values cause trouble
Excel treats a cell as text when its content is a string of characters. Text does not sum, sort numerically, or take part in date arithmetic. Common causes are:
- Data pasted or imported from a web page, CSV file, or another system.
- A cell formatted as Text before you typed the entry.
- A leading apostrophe, a trailing space, or a non-breaking space inside the value.
- A date in an order your regional settings do not recognise.
Signs of text include left alignment (the default for text), a small green triangle in the corner, and a SUM that ignores the cell. Changing the format to Number does not fix existing text cells. Excel reads the cell again only when you edit it, for example by pressing F2 and then Enter.
Quick conversions
Choose the method by how much data you have.
| Method | Best for | How |
|---|---|---|
| Convert to Number | A few cells with green triangles | Select the cells, click the warning icon, choose Convert to Number |
| Text to Columns | A whole column | Data tab, Text to Columns, Finish (or choose a Date order in step 3) |
| Paste Special | Mixed cleanup | Type 1 in a blank cell, copy it, select the data, Paste Special, Multiply |
| Formula | Keeping the source intact | Use `VALUE` or `DATEVALUE` in a new column |
Converting with formulas
DATEVALUE turns a date written as text into a serial number:
=DATEVALUE("2026-11-27")The result is a serial number, so apply a date format to see a date. VALUE does the same for numbers, so =VALUE("1,234.50") returns 1234.5 when your locale uses a comma for thousands and a period for decimals.
If hidden spaces are the problem, clean the text first:
=VALUE(TRIM(SUBSTITUTE(A2,CHAR(160),"")))SUBSTITUTE removes non-breaking spaces (character 160), which TRIM does not remove. TRIM then removes ordinary extra spaces.
How the conversion flows
Common errors
#VALUE!fromDATEVALUE: the text does not match a date pattern your regional settings accept. Rebuild the date with=DATE(year, month, day)usingLEFT,MID, andRIGHT.- Day and month swapped:
03/04/2026reads as 4 March or 3 April depending on locale. Use Text to Columns and pick the correct order (DMY, MDY, or YMD). - Result shows as a five-digit number: the conversion worked, but the cell still has General format. Apply a date format.
- Leading zeros vanish: converting
00042to a number gives 42. Keep such codes as text unless you need arithmetic.
After converting with formulas, copy the results and use Paste Special, Values to replace the original text.
Exercise
Cell A2 contains the text "2026-11-27" with a trailing non-breaking space. =DATEVALUE(A2) returns an error. Write a formula that returns a valid serial number, and say what to do so it displays as a date.
Show answer
Use =DATEVALUE(TRIM(SUBSTITUTE(A2,CHAR(160),""))). SUBSTITUTE removes the non-breaking space and TRIM removes any ordinary extra spaces. The result is a serial number (46353), so apply a date format such as yyyy-mm-dd to display it as a date.