Skip to content

DATEVALUE

Converts a date stored as text into a real Excel date, the serial number that formulas can sort, subtract and compare.

Syntax

=DATEVALUE()

Date and time

All versions of Excel.

Try it

Edit the formula in B2 or change the inputs. The sheet recalculates as you type.

B2
A
B
C
1
Date as text
Real date
2
2025-03-15
15-Mar-2025
3

B2 =DATEVALUE(A2) returns 15-Mar-2025

How DATEVALUE works

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.

Arguments

date_text
Text that Excel can read as a date, such as "2025-03-15" or "15-Mar-2025", or a cell holding such text. A real date or a number returns #VALUE!. Text that isn't a date also returns #VALUE!.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Convert ISO text to a date

B2 =DATEVALUE(A2)

Result: 15-Mar-2025

The year-month-day order is read the same way in every region. The result is serial number 45731, shown as 15-Mar-2025 with the date format.

B2
A
B
C
1
Date as text
Real date
2
2025-03-15
15-Mar-2025
3

B2 =DATEVALUE(A2) returns 15-Mar-2025

Example 2

Text with a month name

B2 =DATEVALUE(A2)

Result: 15-Mar-2025

Month names remove the day-month ambiguity, so this reads correctly in English-language settings.

B2
A
B
C
1
Date as text
Real date
2
15-Mar-2025
15-Mar-2025
3

B2 =DATEVALUE(A2) returns 15-Mar-2025

Example 3

Date from a text timestamp

B2 =DATEVALUE(LEFT(A2,10))

Result: 15-Mar-2025

LEFT keeps the first ten characters, 2025-03-15, and DATEVALUE converts them.

B2
A
B
C
1
Logged (text)
Date only
2
2025-03-15 14:30
15-Mar-2025
3

B2 =DATEVALUE(LEFT(A2,10)) returns 15-Mar-2025

Example 4

Days between two text dates

C2 =DATEVALUE(B2)-DATEVALUE(A2)

Result: 11

Each text date becomes a serial number, and the subtraction gives the gap in days.

C2
A
B
C
1
Start (text)
End (text)
Days
2
2025-03-03
14-Mar-2025
11
3

C2 =DATEVALUE(B2)-DATEVALUE(A2) returns 11

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In B2, convert the text date in A2 into a real date. Fill it down to B3.

Answer in B2, then it fills down to B3.

B2
A
B
C
D
E
1
Date (text)
Real date
Days apart
2
2025-03-03
3
14-Mar-2025
4
5

Common mistakes

  • A real date returns #VALUE!. DATEVALUE works only on text, so test with ISNUMBER first, or wrap it: =IF(ISNUMBER(A2),A2,DATEVALUE(A2)).
  • Ambiguous formats depend on regional settings. "03/04/2025" is 3 April in some regions and 4 March in others. Prefer YYYY-MM-DD or a month name, or rebuild the date with DATE.
  • The result is a number such as 45731. Apply a date format to see a date.
  • Extra characters make it fail. A trailing space, a weekday prefix or a non-breaking space from a web page gives #VALUE!. Clean the text with TRIM and SUBSTITUTE first.
  • DATEVALUE drops the time. Use VALUE on a date-and-time text to keep it.

Questions people ask

How do I convert text to a date in Excel?

Use `=DATEVALUE(A2)` and format the result as a date. For a whole column, Data, Text to Columns, Finish, with a date format chosen in step 3, converts it in place.

Why does DATEVALUE return #VALUE!?

The cell isn't text that Excel reads as a date. It may already be a real date, contain extra spaces or characters, or be in a format your regional settings don't accept.

How do I tell whether a date is text?

Use `=ISNUMBER(A2)`. FALSE means text. Text dates are also left-aligned, and they don't respond to a date format.

Does DATEVALUE work with day-first dates like 15/03/2025?

Only when your regional settings are day-first. Otherwise Excel can't read it, or reads it wrongly. Build it safely with `=DATE(RIGHT(A2,4),MID(A2,4,2),LEFT(A2,2))`.

What is the difference between DATEVALUE and VALUE?

DATEVALUE returns only the date part. VALUE converts any text number, date or time, and keeps the time of day if the text has one.

Learn DATEVALUE in a real sheet.

Tracks take you from the basics to modelling, one graded exercise at a time.