The DATEVALUE function takes a date value in any valid format and returns it as a serial number. Spreadsheets store dates and times as serial numbers in Google Sheets, so they work in formulas (you can add March plus June).
You can use the DATEVALUE function to prepare dates to be sorted, filtered, or used in formulas.
The input for this function needs to be either surrounded by quotes or a cell reference.
The DATEVALUE function returns a serial number from any valid date.
date_text– The date, written in a text format, for the function to convert
TIMEVALUE – Converts a time to a numeric value similar to DATEVALUE
YEAR – Returns the year value from a date
MONTH – Returns the month value from a date
DAY – Returns the day value from a date
#VALUE! – The inputs aren’t a valid date, such as “A minute ago” or “Then.”
#NUM! – An input is a number but is not a valid date.
Example 1 – Plain and Simple
|March 1, 2017|
We have a date-value that Sheets recognizes to return a serial number. In this case, we set the formatting to Date to show the serial number as March 1, 2017. If you set the formatting to number, the result of the function would be 42,795.00.
Example 2 – Unrecognized Text Date
Secondly, a full date typed as 1st instead of 1 returns a #VALUE! error. The #VALUE! error occurs whenever Sheets cannot figure out the text date.
Example 3 – Just a Day and Month
|March 1, 2022|
Just a day and a month typed in. The spreadsheet assumes the date should be the current year when we updated this article in 2022. The year value will always be the present year when viewed in the live spreadsheet.
Example 4 – Used in an employee timesheet
Last, below is an example of this function creating an employee timesheet.
Live examples in Sheets
Go to this spreadsheet for the examples of the DATEVALUE function shown above that you can study and use anywhere you would like.