DATEVALUE function

This article describes the formula syntax and usage of the DATEVALUE function (function: A prewritten formula that takes a value or values, performs an operation, and returns a value or values. Use functions to simplify and shorten formulas on a worksheet, especially those that perform lengthy or complex calculations.) in Microsoft Office Excel.

Description

The DATEVALUE function converts a date that is stored as text to a serial number that Excel recognizes as a date. For example, the formula =DATEVALUE("1/1/2008") returns 39448, the serial number of the date 1/1/2008.

 Note   The serial number returned by the DATEVALUE function can vary from the preceding example, depending on your computer's system date settings.

The DATEVALUE function is helpful in cases where a worksheet contains dates in a text format that you want to filter, sort, or format as dates, or use in date calculations.

To view a date serial number as a date, you must apply a date format to the cell. Find links to more information about displaying numbers as dates in the See Also section.

Syntax

DATEVALUE(date_text)

The DATEVALUE function syntax has the following argument:

Using the default date system in Microsoft Excel for Windows, the date_text argument must represent a date between January 1, 1900 and December 31, 9999. Using the default date system in Excel for the Macintosh, the date_text argument must represent a date between January 1, 1904 and December 31, 9999. The DATEVALUE function returns the #VALUE! error value if the value of the date_text argument falls outside of this range.

If the year portion of the date_text argument is omitted, the DATEVALUE function uses the current year from your computer's built-in clock. Time information in the date_text argument is ignored.

Remarks

  • Excel stores dates as sequential serial numbers so that they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

For more information, see Change the date system, format, or two-digit year interpretation.

  • Most functions automatically convert date values to serial numbers.

Example

The example may be easier to understand if you copy it to a blank worksheet.

ShowHow do I copy an example?

  • Select the example in this article.

 Important   Do not select the row or column headers.

Selecting an example from Help

Selecting an example from Help
  • Press CTRL+C.
  • In Excel, create a blank workbook or worksheet.
  • In the worksheet, select cell A1, and press CTRL+V.

 Important   For the example to work properly, you must paste it into cell A1 of the worksheet.

  • To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.

After you copy the example to a blank worksheet, you can adapt it to suit your needs.


 
1
2
3
4
5

6

7

8



9


10
A B C
Data
11
3
2008
Formula Description Result
=DATEVALUE("8/22/2008") Serial number of the text date, using the 1900 date system. 39682
=DATEVALUE("22-AUG-2008") Serial number of the text date, using the 1900 date system. 39682
=DATEVALUE("2008/02/23") Serial number of the text date, using the 1900 date system. 39501
=DATEVALUE("5-JUL") Serial number of the text date, using the 1900 date system, and assuming the computer's built-in clock returns 2008 as the current year. 39634
=DATEVALUE(A2 & "/" & A3 & "/" & A4) Serial number of the date created by concatenating the data in cells A2, A3, and A4. 39755

 Note   To view the serial number as a date, select the cell, and then on the Home tab, in the Number group, click the arrow next to Number Format, and click Short Date or Long Date.

 
 
Applies to:
Excel 2007