Excel Convert Time String to Time
In this article
To convert a time string in Excel into a real time value, use the TIMEVALUE function, which turns text like "3:45 PM" into a decimal time that Excel can format and calculate with. If your string includes a date, combine TIMEVALUE with DATEVALUE, or use the VALUE function for strings Excel already recognizes. This article explains the formulas, how to handle tricky formats, and common pitfalls.
in t | Time string | - | 3:45 PM | 0 out time | Converted time (decimal) | - | TIMEVALUE(t) | 4 out formatted | Formatted time | - | TEXT(TIMEVALUE(t), "h:mm AM/PM") | 0
Formula
The core formula is TIMEVALUE(time_text), where time_text is a text string that Excel can interpret as a time. The result is a decimal number between 0 and 0.999999, representing the fraction of a 24-hour day. For example, 0.5 is 12:00 PM, and 0.25 is 6:00 AM. If the string includes a date, use DATEVALUE(text) to get the date serial number (days since 1900-01-01) and add the two: DATEVALUE("2025-01-15 14:30") + TIMEVALUE("2025-01-15 14:30").
Worked Example
Using the default input "3:45 PM":
- Enter
=TIMEVALUE("3:45 PM")in a cell. - Excel returns 0.65625 (since 3:45 PM is 15.75 hours after midnight, divided by 24).
- Format the cell as time (e.g.,
h:mm AM/PM) to display 3:45 PM.
The calculator above shows the same result: 0.6563 when rounded to 4 decimals.
When to Use TIMEVALUE vs. VALUE
Use TIMEVALUE when the string is purely a time (e.g., "14:30") or includes AM/PM. Use VALUE when the string is a full date-time (e.g., "2025-01-15 14:30") that Excel already recognizes as a date. VALUE will convert the entire string to a serial number, while TIMEVALUE only extracts the time portion. If you have a string like "3:45 PM" and use VALUE, you get the same result as TIMEVALUE because Excel treats it as a time-only string.
How to Format the Result
After conversion, the cell may show a decimal (e.g., 0.65625). To display it as a time, apply a time number format: right-click the cell, choose Format Cells, select Time, and pick a format like 1:30 PM or 13:30. Alternatively, use the TEXT function to convert the decimal to a text time string: =TEXT(A1, "h:mm AM/PM"). This is useful for concatenating times with other text, but remember the result is text, not a numeric time.
Common Mistakes and How to Fix Them
- String not recognized: If TIMEVALUE returns #VALUE!, the text isn't a valid time. Check for extra spaces, non-breaking spaces, or unusual separators (e.g., "3.45 PM" instead of "3:45 PM"). Use
=TRIM(A1)to remove extra spaces. - 24-hour vs 12-hour: Excel interprets "3:45" as 3:45 AM unless you add "PM". If your data uses 24-hour format (e.g., "15:45"), TIMEVALUE works fine. If it uses 12-hour without AM/PM, assume AM.
- Date-time strings: For "2025-01-15 14:30", TIMEVALUE returns 0.60417 (14:30 as fraction of day), ignoring the date. To keep the date, use
=DATEVALUE(LEFT(A1,10)) + TIMEVALUE(RIGHT(A1,5))or simply=VALUE(A1)if Excel recognizes it. - Time as decimal: If your string is a decimal like "0.5", TIMEVALUE won't work; instead multiply by 24 to get hours (0.5*24 = 12 hours).
Alternatives to TIMEVALUE
If your time strings are in a non-standard format (e.g., "3h45m"), you can parse manually using functions like LEFT, MID, and FIND. For example, to convert "3h45m" to minutes: =VALUE(LEFT(A1, FIND("h",A1)-1))*60 + VALUE(MID(A1, FIND("h",A1)+1, FIND("m",A1)-FIND("h",A1)-1)). For bulk conversion, you can also use Power Query (Get & Transform) to split columns and combine into a time. These methods are useful when dealing with imported data that doesn't follow Excel's standard time formats.
Frequently Asked Questions
Why does TIMEVALUE return a decimal instead of a time?
Excel stores times as fractions of a day. To see a time, you must format the cell as a time format. The decimal is the underlying value that allows calculations (e.g., adding durations).
How do I convert a time string with a date like "2025-01-15 14:30"?
Use =DATEVALUE("2025-01-15") + TIMEVALUE("14:30") to get a serial number that includes both date and time. If the string is in a single cell, you can use =VALUE(A1) if Excel recognizes it, or split with LEFT and RIGHT.
Can I convert a time string to minutes or seconds?
Yes. After converting to a decimal time, multiply by 1440 to get minutes (since 1 day = 1440 minutes) or by 86400 for seconds. For example, =TIMEVALUE("1:30")*1440 returns 90 minutes.
What if my time string has a comma or period instead of a colon?
Replace the delimiter first using SUBSTITUTE. For example, =TIMEVALUE(SUBSTITUTE(A1, ".", ":")) will convert "3.45 PM" to a valid time. Be careful with decimal points in seconds.
How do I convert a time string that includes milliseconds?
TIMEVALUE handles milliseconds if the string is like "12:34:56.789". The result will include the fractional second. Format the cell with a custom format like h:mm:ss.000 to see milliseconds.