Microsoft Excel DATEVALUE Function
Basic Description
The Excel Datevalue function converts a text representation of a date, into an Excel date.
- ie. the function converts a text string representing a date, into the serial number that represents the date in Excel's date-time code.
The syntax of the Datevalue function is :
DATEVALUE( date_text )
where the date_text argument is a text string representing a date.
Interpretation of Date Text Strings
When reading in the supplied date_text argument, the Datevalue function follows simple rules that are the same as if you type a date directly into a cell. These are :
|
These rules are illustrated in the examples below.
Datevalue Function Examples
The following spreadsheet shows examples of the Excel Datevalue function:
Formulas:
|
Results:
|
In the above example spreadsheet:
- The text string in cell A3 contains just a day and month, and so the function returns a date in the current year. As these examples were input into Excel in the year 2012, the returned date has the year 2012.
- The cells in the results spreadsheet all have the general formatting type. These values can be displayed as dates by setting the cell formatting to the date type. To do this:
The resulting formatted spreadsheet is shown on the right.
For more details on formatting in Excel, go to the Excel Formatting page.
|
Results with date formatting:
|
Datevalue Function Common Error
If you get an error from the Excel Datevalue function, this is likely to be the #VALUE! error :
Common Error:
#VALUE! | - | Occurs if the supplied date_text cannot be recognised as a valid Excel date. |
No comments:
Post a Comment