Excel, DATEVALUE() Function
The DATEVALUE() function receives as input a text string representing a date. The function returns as output the date value corresponding to the input date text string.
Jump To:
Contents
Syntax:
=DATEVALUE(Date_Text)
Date_Text: A text string representing a date.
Basic Example:
In the example below, using the DATEVALUE() function the expression “Jan, 23, 2002” is converted to a date:
Why?
You might be wondering why we would want to convert the expression “Jan, 23, 2002” to a date value using the DATEVALUE() function? Why didn’t we just write the expression “Jan, 23, 2002” in cell A1 instead of using the function below:
=DATEVALUE("Jan, 23, 2002")
The expression “Jan, 23, 2002” is a text string. The result of the function above is a date value. There are many built in functions in Excel which only accept date values:
- NETWORKDAYS()
- WEEKDAY()
- DAYS360
- …
Therefore if you wish to use those functions you must convert the date expression into a date value.
More Examples:
Below you can see some of the accepted input text string formats. Note the output of the function in all the examples is a date value. The output date format depends on the number format chosen for the cell:
Type 1:
=DATEVALUE("01/23/2002")
=DATEVALUE("01/23/02")
Type 3:
=DATEVALUE("January 23, 2002")
=DATEVALUE("23 January 2002")
All the text expressions above result in the same date value.
Result:
See also:
If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website www.software-solutions-online.com