Excel - DATEVALUE Function



DATEVALUE Function

The DATEVALUE function transforms a date written as text into a serial number. It is very beneficial when dealing with a dataset that contains the date value in text form. It is categorized under the DATE and TIME functions in Excel.

You may also extract the independent component, like YEAR or MONTH, of a text date while combining it with the YEAR and MONTH functions. You may filter and sort out these text-based dates and merge the DATEVALUE function with other functions like DATEDIF, and IF functions to evaluate complicated tasks.

Compatibility

This advanced Excel function is compatible with the following versions of MS Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016
  • Excel 2013
  • Excel 2010
  • Excel 2007

Syntax

The syntax of the DATEVALUE function is as follows −

DATEVALUE (date_text)

Arguments

You can use the following arguments with the DATEVALUE function −

Argument Description Required / Optional
date_text It specifies the date entered as a text string enclosed in the quotation marks. Required

Points to Remember

  • date_text Argument
    • The date_text argument must specify a date between January 1, 1900, and December 31, 9999, using Microsoft Excel for default date system of Windows.
    • This function will retrieve the #VALUE! Error if the date_text argument lies outside this range.
    • If the date_text argument's year component is skipped, then the DATEVALUE function utilizes the current year from your computer's built-in clock. The time part in this argument can be skipped.
  • The Microsoft Excel tool saves dates as sequential serial numbers for further calculations. By default, serial number 1 is assigned to January 1, 1900, and serial number 39448 is assigned to January 1, 2008.

Examples of DATEVALUE Function in Excel

Practice the following examples to get the master proficiency of the DATEVALUE function in Excel.

Example 1: How to use the DATEVALUE Function in Excel?

In this example, we will insert the DATEVALUE function in the selected range of cells by specifying the dates with different formats.

Solution

Step 1 − First, assume the sample dataset comprises the Date and Date Value columns. The B column specifies the Date in different formats.

How to use DATEVALUE Function in Excel1

Step 2 − After that, enter the formula =DATEVALUE("8/22/2015") in the C2 cell and hit the Enter tab.

How to use DATEVALUE Function in Excel2

Therefore, the DATEVALUE function will retrieve the #VALUE! Error as an invalid date value is specified in the C2 cell.

How to use DATEVALUE Function in Excel3

Step 3 − Furthermore, select cell C3, write the formula =DATEVALUE("25-12-2015"), and hit the Enter tab.

How to use DATEVALUE Function in Excel4

Hence, the DATEVALUE function returns the 42363 serial number.

How to use DATEVALUE Function in Excel5

Step 4 − Afterward, place the cursor on the C4 cell and write the formula =DATEVALUE("25-12-2015").

How to use DATEVALUE Function in Excel6

Therefore, the DATEVALUE function returns the serial number 426363.

How to use DATEVALUE Function in Excel7

Example 2: Using the DATEDIF Function with the DATEVALUE Function in Excel

In this example, we will evaluate the difference between a date written as a text and today's date.

Solution

Navigate to the Sheet 2 worksheet and enter the formula =DATEDIF( DATEVALUE("21-02-24"), TODAY(), "d") in the C2 cell.

 DATEDIF Function with the DATEVALUE Function1

After that, press the Enter tab to get the difference between these dates, 314.

 DATEDIF Function with the DATEVALUE Function2

Download Practice Sheet

You can download and use the sample data sheet to practice the DATEVALUE function.

Advertisements