Excel guide · 6 min read
How to convert text to a date in Excel
=DATEVALUE(B2) converts it to a date serial number; format the cell as a date to see it. For text in a different order, such as dd/mm/yyyy on a US system or 20261005 from another program, rebuild it with DATE, for example =DATE(RIGHT(B3,4),MID(B3,4,2),LEFT(B3,2)). For a whole column, Data > Text to Columns converts in place.Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | |
|---|---|---|
| 1 | Exported from | Date |
| 2 | US bank CSV | 10/5/2026 |
| 3 | UK supplier | 05/10/2026 |
| 4 | UK supplier | 23/10/2026 |
| 5 | Web shop | 2026-10-05 |
| 6 | CRM | Oct 5, 2026 |
| 7 | Payroll system | 20261005 |
| 8 | German office | 5.10.2026 |
| 9 | Typed in Excel | Oct 5, 2026 |
Download this sheet as an Excel practice file (.xlsx)
First check: is it a date or text?
Column B was pasted together from six systems. Every row except B4 (Oct 23) means October 5, 2026, written six different ways. Only B9, typed into Excel, is a real date. The rest are text that looks like a date, so sorting, SUMIFS date ranges and date math either fail or give wrong answers.
ISNUMBER is the definite test, because a real date is a number underneath. Text dates are also left-aligned by default and ignore any date format you apply. To count how many cells in a column are real dates, use =SUMPRODUCT(--ISNUMBER(B2:B9)), which returns 1 here.
Result: FALSE
FALSE. B2 shows 10/5/2026 but it is text. =ISNUMBER(B9) returns TRUE.
Method 1: DATEVALUE or a double minus
DATEVALUE reads date text using your computer's regional settings and returns the date's serial number. On a US-English system it handles 10/5/2026, 2026-10-05, Oct 5, 2026 and 5-Oct-2026. Excel shows the result as a number like 46300 until you format the cell as Short Date.
A double minus does the same job in shorter form: =--B5 forces Excel to convert the text to a number, which for date text means a date. VALUE(B5) works too. One difference: if the text contains a time, DATEVALUE drops it and VALUE or -- keeps it.
Result: 46300 shows as Oct 5, 2026 with the custom mmm d, yyyy format
46300, the serial number for Oct 5, 2026. Format the cell as a date to see it as one.
The silent trap: day-first text on a month-first system
The UK supplier sends 05/10/2026, meaning 5 October. A US-English Excel reads text as month/day/year, so DATEVALUE happily returns May 10, 2026. No error, no warning, wrong date. B4, 23/10/2026, does fail with #VALUE! because there is no month 23. A column with some errors and some "working" rows is the classic sign that every row is being read in the wrong order.
The reverse happens too: a UK or European Excel will read US text like 10/5/2026 as 10 May. DATEVALUE is only safe when the text order matches the computer it runs on.
Result: 46152 shows as May 10, 2026 with the custom mmm d, yyyy format
46152, which is May 10, 2026, not the October 5 the supplier meant.
Method 2: DATE with LEFT, MID and RIGHT (works on any system)
When you know the order of the text, pull out each part and give it to DATE(year, month, day). Nothing depends on regional settings, so the workbook gives the same answer in New York and London. For dd/mm/yyyy, the year is the last 4 characters, the month starts at character 4, and the day is the first 2.
For yyyymmdd from payroll and banking systems (B7), the parts are in a different place: =DATE(LEFT(B7,4),MID(B7,5,2),RIGHT(B7,2)) returns Oct 5, 2026. This also works when 20261005 arrived as a number rather than text, because LEFT and MID treat numbers as text.
Result: Oct 23, 2026
Oct 23, 2026, from the 23/10/2026 that DATEVALUE rejected. On B3 the same formula gives Oct 5, 2026.
When the day and month are not always two digits
Fixed positions break on text like 5.10.2026, where the day has one digit. In Excel 365 and 2024, TEXTBEFORE and TEXTAFTER split on the separator instead of counting characters, so 5.10.2026 and 15.10.2026 both work.
Do not just replace the dots with slashes and use DATEVALUE. =DATEVALUE(SUBSTITUTE(B8,".","/")) on a US system turns 5.10.2026 into May 10 for the same reason as above. In older Excel, Text to Columns with DMY (below) is the easier route.
Result: Oct 5, 2026
Oct 5, 2026. TEXTBEFORE(B8,".") is the day, the piece between the dots is the month, and the text after the 2nd dot is the year.
Columns with some real dates and some text
A column that mixes typed dates with pasted text is common after a few months of copy and paste. DATEVALUE returns #VALUE! when the cell is already a real date, because it only accepts text. Test first and pass real dates through untouched.
Result: 46300 shows as Oct 5, 2026 with the custom mmm d, yyyy format
46300 (Oct 5, 2026): B9 is already a date, so it is kept. On B2 the same formula converts the text, also to 46300.
Method 3: Text to Columns (whole column, no formulas)
To convert a column in place, Text to Columns is the fastest way, and its date option lets you say what order the text is in. That makes it the right tool for dd/mm text on a US system, and the reverse. It works in every version of Excel. Select one column at a time.
- Select the text dates, for example B3:B4.
- Go to Data > Text to Columns.
- Choose Delimited and click Next.
- Untick every delimiter and click Next.
- Under Column data format choose Date, then pick the order the text is in: DMY for 05/10/2026, MDY for 10/5/2026, YMD for 2026-10-05 or 20261005.
- Click Finish, then format the column as Short Date.
Method 4: Power Query for imports you repeat
If the same export arrives every week, set the conversion up once in Power Query. Select the data and choose Data > From Table/Range. Right-click the date column, choose Change Type > Using Locale, pick Date and the locale the file came from, such as English (United Kingdom), and click OK. Then Home > Close & Load. Next week, paste the new data in and click Data > Refresh All.
Common mistakes
Trusting DATEVALUE on day-first text
On a month/day system it reads 05/10/2026 as May 10 without any error. Rebuild the date with DATE(RIGHT(),MID(),LEFT()) or use Text to Columns with DMY.
Changing the number format and expecting the text to become a date
Formats do not change text. The cell stays text until you convert it with a formula, Text to Columns or Power Query.
Getting #VALUE! from DATEVALUE on a cell that looks fine
The cell may already be a real date (DATEVALUE only accepts text), or the text has an order or month name your regional settings do not recognise. Test with ISNUMBER first and use IF(ISNUMBER(B2),B2,DATEVALUE(B2)).
Seeing 46300 instead of a date
The conversion worked; that is the date serial number. Format the cell with Home > Number Format > Short Date.
FAQ
How do I convert text to a date in Excel?
If the text matches your system's date order, use =DATEVALUE(A2) and format the result as a date. If it does not, rebuild it with DATE and LEFT, MID and RIGHT, or use Data > Text to Columns and choose the matching order (DMY, MDY or YMD).
How do I convert yyyymmdd to a date in Excel?
Use =DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2)). It works whether 20261005 is stored as text or as a number. For a whole column, Text to Columns with Date set to YMD does the same in place.
Why does DATEVALUE give me the wrong month?
DATEVALUE follows your computer's regional date order. Day-first text such as 05/10/2026 is read as May 10 on a US system. Use the DATE formula with the parts in the right order, which does not depend on regional settings.
How can I tell if a date in Excel is text?
Use =ISNUMBER(A2): it returns TRUE for a real date and FALSE for text. Text dates are usually left-aligned, and changing their number format has no visible effect.
What does -- do in front of a cell?
The double minus negates the value twice, which forces Excel to turn text into a number. For date text like 2026-10-05 the number is the date's serial number, so =--A2 works like DATEVALUE but also keeps any time in the text.
Functions used
DATEVALUEText date to a real dateVALUEText to numberDATEBuilds a dateLEFTCharacters from the startMIDCharacters from the middleRIGHTCharacters from the endISNUMBERIs it a number?IFPicks a result from a testTEXTBEFOREText before a delimiterTEXTAFTERText after a delimiterSUBSTITUTEReplaces textSUMPRODUCTMultiply then add
Related guides
- Excel dates not sorting correctly: how to fix it
- How to convert numbers stored as text in Excel
- How to remove the time from a date in Excel
- #VALUE! error in Excel: causes and fixes
- How to remove characters from a cell in Excel
- How to extract numbers from a string in Excel
- How to add leading zeros in Excel
Updated