Sub topic 16
Converting text to numbers and dates
This chapter assumes you know that a cell holds a stored value and a separate display format, that you can write a basic formula, and that you can open Format Cells. It covers how to spot values that Excel treats as text, why they appear, and how to convert them.
Why text looks like a number
Excel decides what a cell holds when you enter or import data. If it cannot read the entry as a number, date, or time, it stores text. Text does not sum, sort numerically, or take part in date arithmetic.
Common causes:
- A CSV or web import that brings in values as text.
- A leading apostrophe, as in
'123. - A cell formatted as Text before the value was entered.
- Leading or trailing spaces.
- Non-breaking spaces (character code 160) copied from web pages or databases.
- Separators that do not match your regional settings, such as
1.234,56on a system that uses a period as the decimal mark. - Trailing minus signs, as in
45-, which some systems export. - Dates in an order or style your locale does not recognize.
Recognizing text values
Check for these signs:
- Left alignment in a cell with default alignment. Numbers align right by default.
- A green triangle in the corner, which is the error-checking flag "Number Stored as Text".
- A SUM that ignores some cells. The status bar also shows a Count but no Sum for a selection that contains only text.
=ISNUMBER(A2)returning FALSE.
A reliable test is =ISNUMBER(A2). It does not depend on how the cell looks.
=ISNUMBER(A2)=LEN(A2)If LEN returns more characters than you can see, the cell contains hidden spaces or other invisible characters.
Changing the format does not convert
Switching a text cell to the Number format does nothing to the stored text. The cell holds a string, and a format only affects how numeric values are displayed.
A cell that is formatted as Text keeps new entries as text. To fix it, change the format to General, then re-enter each value. Pressing F2 and then Enter re-enters a cell. For many cells, use one of the methods below.
Method 1: Error-checking menu
Select the cells with green triangles. A warning icon appears next to the selection. Open its menu and choose Convert to Number. This is quick for small ranges. It only works on values Excel can read as numbers, and it does not appear when error checking is turned off.
Method 2: Text to Columns
This works in place and is useful for a whole column.
- Select the column.
- Choose Data, then Text to Columns.
- Choose Delimited, then Next, and Next again.
- On the last step, leave Column data format as General for numbers. For dates, choose Date and pick the order the text uses, such as YMD or DMY.
- Choose Finish.
The Date option is the most controlled way to convert ambiguous dates. You tell Excel the order, so 03/04/2026 is read the way you specify, not the way your regional settings guess. The cell then shows a date in your default format. Change the format afterward if you want something else.
Method 3: Paste Special with Multiply
- Type
1in an empty cell and copy it. - Select the text values.
- Choose Paste Special, then Multiply, then OK.
Multiplying by 1 forces Excel to read each text value as a number. Values it cannot read produce #VALUE!. Delete the helper cell afterward. If the results show as serial numbers, apply a date or time format.
Method 4: Formulas
Formulas keep the original column and write the converted values in another. Use them when the source refreshes or when cleanup is needed.
=VALUE(A2)=--A2Both convert text such as "1250.5" to the number 1250.5. The double minus negates twice. VALUE is easier to read.
To clear regular and non-breaking spaces first:
=VALUE(TRIM(SUBSTITUTE(A2,CHAR(160)," ")))TRIM removes ordinary leading and trailing spaces and collapses repeated spaces inside the text. It does not remove character 160, so SUBSTITUTE replaces that character with a normal space first.
For a trailing minus sign:
=IF(RIGHT(A2,1)="-",-VALUE(LEFT(A2,LEN(A2)-1)),VALUE(A2))For separators that differ from your locale, use NUMBERVALUE. It takes the text, the decimal separator, and the group separator.
=NUMBERVALUE("1.234,56",",",".")This returns 1234.56 whatever your regional settings say. NUMBERVALUE is available in Excel 2013 and later.
Converting text to dates
A date is a serial number that has a date format applied. Converting text to a date therefore means producing the serial number, then formatting it.
DATEVALUE converts text that Excel recognizes as a date:
=DATEVALUE("2026-11-27")This returns 46353. The cell shows 46353 until you apply a date format. For text times, TIMEVALUE returns the fraction of a day.
=TIMEVALUE("14:30")This returns 0.604166667, which is 14.5 hours divided by 24.
Locale dependence
DATEVALUE uses your regional settings to read text. For "03/04/2026", a US system reads March 4, and many European systems read April 3. The same workbook can give different results on different machines, and no error appears. The ISO order yyyy-mm-dd is read consistently in most locales, but that is not guaranteed everywhere.
The safest approach is to take the text apart and build the date with DATE. Then no regional rule is involved.
For text like 20261127:
=DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2))For text like 27/11/2026, where the order is known to be day, month, year:
=DATE(RIGHT(A2,4),MID(A2,4,2),LEFT(A2,2))Excel converts the extracted text pieces to numbers automatically inside DATE. This assumes a fixed layout with two-digit day and month. If the layout varies, use FIND to locate the separators.
Choosing a method
| Situation | Method |
|---|---|
| A few cells with green triangles | Convert to Number |
| A whole column, one time | Text to Columns |
| Data that refreshes | Formula in a helper column |
| Foreign separators | `NUMBERVALUE` |
| Ambiguous date order | Text to Columns with a chosen order, or `DATE` |
Common problems
- Results show as 46353 or 0.604. The value converted correctly. Apply a date or time format.
#VALUE!appears. The text still contains something Excel cannot read, such as a currency symbol that does not match your locale, or a hidden character. CompareLENwith the visible length.- Leading zeros disappear. Numbers have no leading zeros. Do not convert ZIP codes, phone numbers, or product codes. Keep them as text.
- Long numbers change. Excel keeps 15 significant digits. Credit card numbers or long IDs lose precision when converted, so keep them as text.
- Formulas stay as formulas. Helper-column results depend on the source. Copy them and use Paste Special, then Values, if you need static numbers, then remove the source column.
- Dates convert wrongly with no error. A day value of 12 or less can be read as a month. Check some dates with a day above 12 to confirm the order.
Exercise
A column contains the text 1.234,56, and your system uses a period as the decimal mark. Write a formula that returns the number 1234.56 regardless of regional settings.
Show answer
=NUMBERVALUE(A2,",",".") reads the comma as the decimal separator and the period as the group separator, so it returns 1234.56.
Exercise
Cell A2 holds the text 20261127. Write a formula that returns a real date that does not depend on regional settings, and say what you must do for it to display as a date.
Show answer
=DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2)) returns the serial number 46353. Apply a date format, such as yyyy-mm-dd, to the cell so it displays as 2026-11-27.
Exercise
You changed a column's format from Text to Number, but SUM still returns 0. Why, and what is one way to fix it?
Show answer
The cells still contain text, because a format change does not convert existing values. Select the cells and use Text to Columns with Finish, Convert to Number from the error-checking menu, or Paste Special with Multiply by 1.