Date and Time - DATEVALUE Function



Description

The DATEVALUE function converts a date in the form of text to a serial number (Excel's date-time code).

The DATEVALUE function converts a date that is stored as text to a serial number that Excel recognizes as a date. For example,

=DATEVALUE ("1/1/2008")

returns 39448, the serial number of the date 1/1/2008.

Note − Your computer's system date setting may cause the results of a DATEVALUE function to vary from this example.

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.

Syntax

DATEVALUE (date_text)

Arguments

Argument Description Required/ Optional
date_text

Text that represents a date in an Excel date format, or a reference to a cell that contains text that represents a date in an Excel date format. For example, "1/30/2008" or "30-Jan-2008" are text strings within quotation marks that represent dates.

See Notes below.

Required

Notes

  • date_text 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

    • This function returns the #VALUE! Error value if the value of the date_text argument falls outside this range.

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

  • 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.

  • Most functions automatically convert date values to serial numbers.

Applicability

Excel 2007, Excel 2010, Excel 2013, Excel 2016

Example

DATEVALUE Function
advanced_excel_date_time_functions.htm
Advertisements