Purpose
Return value
Syntax
=TIMEVALUE(time_text)
- time_text - A date and/or time in a text format recognized by Excel.
How to use
Sometimes, times in Excel appear as text values that are not recognized properly as time. The TIMEVALUE function is meant to parse a time that appears as a text value into a valid Excel time. A native Excel time is more useful than text because it is a numeric value that can be formatted as time and directly manipulated in a formula.
The TIMEVALUE function takes just one argument, called time_text. If time_text is a cell address, the value in the cell must be text. If time_text is entered directly into the formula it must be enclosed in double quotes (""). Time_text should be supplied in a text format that Excel can recognize, for example, "6:45 PM" or "18:45". TIMEVALUE ignores dates if present in a text string.
The TIMEVALUE function creates a time in serial number format from a date and/or time in an Excel text format. TIMEVALUE will return a decimal number between 0 and 0.99988426, representing 12:00:00 AM to 11:59:59 PM. Because the maximum value returned by TIMEVALUE is less than 1, hours will reset every 24 hours (like a clock).
Examples
The formulas below show the output from TIMEVALUE:
=TIMEVALUE("12:00") // returns 0.5
=TIMEVALUE("12:00 PM") // returns 0.5
=TIMEVALUE("18:00") // returns 0.75
To display the output from TIMEVALUE as a formatted time, apply a time number format.
Alternative formula
Notice that the TIMEVALUE formula in C15 fails with a #VALUE! error, because cell B15 already contains a valid time. This is a limitation of the TIMEVALUE function. If you have a mix of valid and invalid dates, you can use the simple formula below as an alternative:
=A1+0
The math operation of adding zero will cause Excel will try to coerce the value in A1 to a number. If Excel is able parse the text into a proper time it will return a valid time as a decimal number. If the time is already a valid Excel time, adding zero will have no effect, and generate no error.
Notes
- TIMEVALUE will return a #VALUE error if time_text does not contain time formatted as text.