Excel has a unique way of storing date and time through serial numbers, making it possible to perform mathematical operations and conversions. Dates that are represented as text values can be easily converted to serial numbers by using the DATEVALUE function in Excel. This tutorial will assist all levels of Excel users in the usage and syntax of DATEVALUE function.
Figure 1. Final result: Excel DATEVALUE function
Syntax of the DATEVALUE Function
DATEVALUE function converts a date stored as text into a serial number, where the value 1 represents the date Jan 1, 1900 or 1/1/1900
- Date_text – a text string representing a date in Excel; can be a date enclosed in quotation marks or a cell reference
- If the year portion in the date is omitted, the current year is used by the function
- The date must be between January 1, 1900 and December 31, 9999, otherwise the DATEVALUE function returns the error #VALUE!
- If the date_text argument includes a time value, the function only returns the value for date, ignoring the time
Setting up our Data
Here we have a template containing two columns: Date (column B) and Result (column C).
Figure 2. Sample template for Excel DATEVALUE function
To set up our data, enter the following values in cells B3 to B8:
In cell B3, enter the value: 1/23/2019
B4: ‘Jan 23,2019
B5: ‘Jan 23, 2019
B6: ‘Jan 23
We want to convert the date “January 23, 2019” into a serial number, but by using different formats. The results will be recorded in column C.
Note that the value in B3 is inputted in date format, while the rest of the values are inputted as text by using an apostrophe ’ at that start of the text string. It is important to enter the values exactly as specified above in order to have a better understanding of the DATEVALUE function. After inputting the data in column B, our table looks like this:
Figure 3. Sample data to convert dates into serial numbers
Convert dates into serial numbers
We want to convert the date “January 23, 2019” into a serial number by using the DATEVALUE function. Let us follow these steps:
Step 1. Select cell C3
Step 2. Enter the formula:
Step 3. Press ENTER
Step 4: Copy the formula in cell C3 to cells C4:C8 by clicking the “+” icon at the bottom-right corner of cell C3 and dragging it down
Figure 4. Entering the formula to convert date into serial number using the DATEVALUE function
As discussed earlier, the DATEVALUE function only converts dates in text format. Cell C3 returns an error value #VALUE! because the date is not entered as text.
Although the value in cell B4 is inputted as text, “Jan 23,2019” is not a valid date because there is no space before the year portion. As a result, the function also returns a #VALUE! error in cell C4.
Figure 5. DATEVALUE function returning a #VALUE! error
Cells B5 to B8 contain valid dates in text format. Hence, the function works properly and returns the value “43488” in cells C5 to C8.
Figure 6. Output: Excel DATEVALUE function
The date can also be inputted directly into the DATEVALUE function by enclosing it in quotation marks. Enter this formula in cell C3:
The result in cell C3 is “43488”, which is the same as in the previous examples.
Figure 7. Hardcoding the date into the DATEVALUE function
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.