DATEVALUE turns a date that is stored as text into a real date. Dates imported from other systems, pasted from the web or typed with a leading apostrophe often look like dates but are text, so they won't sort by date, subtract or feed functions such as EOMONTH. =DATEVALUE("2025-03-15") returns 45731, which a date format displays as 15-Mar-2025.
How to spot text dates
A text date is left-aligned by default, a real date is right-aligned. The formula =ISNUMBER(A2) is TRUE for a real date and FALSE for text. If a date column sorts as 1, 10, 11, 2 rather than by date, or SUMIFS with date criteria finds nothing, the dates are probably text.
The one argument
date_text is text that Excel recognises as a date. It can be a cell reference or a quoted string. The accepted formats depend on your regional settings, which is the main risk. The year-month-day form "2025-03-15" is read the same way everywhere. A day-month-year or month-day-year form, such as "03/04/2025", may be March 4 or April 3, depending on the computer. Month names are safer: "15-Mar-2025" works in English-language settings.
DATEVALUE returns the date only. A date-and-time text such as "2025-03-15 14:30" returns just the date part. To get the time as well, use VALUE on the text, or TIMEVALUE for the time part.
When it isn't needed
Excel converts text dates automatically in arithmetic. ="2025-03-14"-"2025-03-03" returns 11 without DATEVALUE. DATEVALUE is worth using when you want the conversion to be visible, when you need the number itself in a cell, or when the text includes extra characters that you have first removed with LEFT, MID or SUBSTITUTE.
Cleaning patterns
- Timestamp text to a date:
=DATEVALUE(LEFT(A2,10)) for text such as 2025-03-15 14:30. - Text with stray spaces:
=DATEVALUE(TRIM(A2)) removes leading and trailing spaces first. - Day-first text in a month-first region: build it yourself:
=DATE(RIGHT(A2,4),MID(A2,4,2),LEFT(A2,2)) for 15/03/2025. - Text to Columns: on the Data tab, it converts a whole column of text dates in one step.
What DATEVALUE can't do
It can't convert a real date, or a number. Both give #VALUE!. It can't interpret dates when the format is ambiguous in your region, and it doesn't convert two-digit years reliably. For a column that fails, rebuild the date from its parts with DATE.