How to Parse Time String To Time in Excel
Learn multiple Excel methods to parse time string to time with step-by-step examples, real-world scenarios, and best practices.
How to Parse Time String To Time in Excel
Why This Task Matters in Excel
Modern workbooks are full of imported data: web downloads, CSV exports from ERP systems, log files created by servers, and even user-typed entries captured through online forms. In many of these sources, times are stored as text strings such as “14:37”, “2:37 PM”, “1437”, “2023-05-01 14:37:05”, or “07h45m”. While humans can read these strings without effort, Excel cannot treat them as genuine times until they are converted to the internal serial-number format that drives time arithmetic, date math, and time-based analysis.
Imagine a call-center performance report where each call record contains a time stamp written as “17h05m32s”. Supervisors will struggle to measure average handle time, peak call hours, or service-level compliance until those text fragments become real times that Excel recognizes. Similar issues appear in manufacturing (equipment logs with “075530” for 07:55:30), finance (Bloomberg exports “14:37:05”), transportation (GPS logs “143705”), and marketing (Google Analytics CSVs that embed date and time in a single string).
If you never master the skill of parsing text into times, you are forced into manual editing, error-prone copy–paste steps, or the dreaded “helper column plus calculator” approach. These workarounds slow every reporting cycle, invite mistakes, and make you look less proficient. Once you do understand how to parse, you unlock downstream capabilities such as:
- Calculating differences (end time minus start time)
- Building dynamic dashboards that group by hour or minute
- Creating pivot tables that slice by time of day
- Feeding cleaned data into Power Query, Power Pivot, or Power BI for further modeling
Excel offers several tools for this task: the intuitive TIMEVALUE function, the flexible VALUE function, string functions like LEFT, MID, RIGHT, and advanced helpers such as TEXTSPLIT, TEXTBEFORE, TEXTAFTER, and Power Query’s transformation steps. Selecting the proper method depends on your data’s exact format, volume, and the Excel version available to you.
Best Excel Approach
The single most reliable path—especially for simple “hh:mm” or “hh:mm:ss” text—is the TIMEVALUE function combined with VALUE. TIMEVALUE analyses a text string and, if the string looks like a valid time to Excel’s engine, converts it to the correct decimal between 0 and 1 (Excel’s representation for any time within a single day).
Syntax:
=TIMEVALUE(time_text)
- time_text – A text string representing a time, for example \"14:37\" or \"2:37 PM\".
- The function returns a serial fraction; format the cell as Time or Custom to display properly.
Why is this the best starting point?
- It is short, easy to read, and self-documenting.
- It respects the regional time settings of the user’s machine, preventing confusion between 24-hour and 12-hour clocks.
- It automatically ignores leading and trailing spaces.
However, TIMEVALUE fails when the string has extra characters like “h”, “m”, “s”, or if date information is blended with the time. That is when you fall back on time-parsing with VALUE plus REPLACE/LEFT/MID, or when you split the text into components and rebuild the time with the TIME function.
Example of an alternative approach for “07h45m”:
=TIME(VALUE(LEFT(A2,2)),VALUE(MID(A2,4,2)),0)
Here we isolate hours, minutes, seconds, and feed them into TIME.
Excel 365 users get an even more powerful option: TEXTSPLIT can break strings at multiple delimiters in one step, letting you build dynamic array formulas that produce correctly parsed times across entire columns without copy-down.
Parameters and Inputs
Before selecting a formula, analyze the source data:
- Location of the string: assume original data sits in column A, rows 2 downward ([A2:A1000]).
- Expected formats: \"14:37\", \"2:37 PM\", \"1437\", \"20230501 143705\", \"07h45m32s\".
- Data type: these cells contain TEXT, not numeric. If they already show as Time when formatted, no parsing is required.
- Optional component: seconds. Some exports omit seconds, others include milliseconds.
- Optional embedded date: strings like \"2023-05-01 14:37:05\". Decide whether to keep the date portion.
- Validation: ensure there are no nulls, placeholders like \"--\", or non-time remarks such as \"TBA\". Use ISNUMBER after the parsing formula to verify success.
- Edge cases: midnight strings “2400”, noon strings lacking AM/PM, or times above 24h that represent duration instead of clock time.
Preparation tip: remove leading/trailing spaces with TRIM or CLEAN if you suspect non-printable characters. For massive datasets, consider running “Text to Columns” with a space delimiter to visually inspect the components before writing formulas.
Step-by-Step Examples
Example 1: Basic Scenario
A CSV export captures login times as text in column A, row 2 downward, formatted “14:37” using a 24-hour clock. We need to turn these into true times.
- Insert a new helper column B titled Parsed Time.
- In B2 enter:
=TIMEVALUE(A2)
- Press Enter and copy the formula down by double-clicking the fill handle.
- Format column B as Time → 13:30:55 or a custom “hh:mm”.
Why it works: TIMEVALUE recognizes the colon as a standard time delimiter. Internally Excel stores 14:37 as 0.60833 because 14 hours + 37 minutes equals roughly 60.833 % of a 24-hour day.
Variations
- If the column contains “2:37 PM” instead, the same TIMEVALUE call still works; Excel respects the AM/PM suffix.
- Use ISNUMBER(B2) to confirm the conversion. Any FALSE result signals a string TIMEVALUE could not parse.
Troubleshooting
- If the result displays as 14.62 instead of 14:37, the cell is formatted General or Number. Re-apply Time format.
- #VALUE! indicates an invalid string, possibly blank or “n/a”. Wrap the formula in IFERROR.
=IFERROR(TIMEVALUE(A2),"")
Example 2: Real-World Application
A manufacturing data logger outputs “Start” and “End” stamps in column B as “2023-05-01 07:55:30”. We wish to keep both the date and time for runtime calculations.
Data setup:
- Column B (B2:B5000) – raw log “2023-05-01 07:55:30” (text)
- Column C – Parsed DateTime
- Column D – Runtime (End minus Start)
Step-by-step:
- In C2, parse the combined date and time with VALUE:
=VALUE(B2)
- Copy down through C5000.
- Format column C as “yyyy-mm-dd hh:mm:ss” so the human-readable value appears.
- In D3, compute runtime:
=IF(AND(ISNUMBER(C3),ISNUMBER(C2)),C3-C2,"")
- Format column D as “[h]:mm:ss” to see total hours exceeding 24h.
Why this works: VALUE converts any text that looks like a valid number or date/time into the correct serial. Because the string includes date and time separated by a space, Excel recognizes it the same way the VALUE function translates “1/1/2023 12:00” to a decimal like 44927.5.
Business pay-off: maintenance supervisors can now chart equipment downtimes by day of week, sum monthly production hours, and compute MTBF (Mean Time Between Failures) with simple SUMIFS, AVERAGEIFS, or pivot tables.
Performance considerations: in large log files exceeding 100 000 rows, formula recomputation may lag. Converting formulas to values after validation (Copy → Paste Special → Values) can speed up dashboards that refresh frequently.
Example 3: Advanced Technique
Marketing analysts receive Facebook Ads reports where video view time is exported as strings like “02h37m45s”. We solely need the time part to later convert to duration in seconds.
Goal: convert “02h37m45s” to a genuine time 0.10955 (which equates to 02:37:45).
- Split hours, minutes, seconds with TEXTSPLIT (Excel 365).
In B2 (raw string in A2):
=LET(
parts, TEXTSPLIT(A2, {"h","m","s"}),
TIME(VALUE(INDEX(parts,1)), VALUE(INDEX(parts,2)), VALUE(INDEX(parts,3)))
)
Explanation:
- TEXTSPLIT chops at the delimiters h, m, s, delivering an array [ \"02\", \"37\", \"45\", \"\" ].
- INDEX extracts each numeric chunk.
- TIME assembles them into a proper serial.
- If you run a pre-365 version, use nested MID and FIND:
=TIME(
VALUE(LEFT(A2,2)),
VALUE(MID(A2,4,2)),
VALUE(MID(A2,7,2))
)
- Copy down the formula.
- Format as Time or keep decimal then multiply by 86400 to get total seconds.
Edge case handling: some rows may have missing seconds, e.g., “02h37m”. Wrap each component in IFERROR to default the missing part to zero.
Professional tip: when ad reports include durations longer than 24 hours (aggregate watch time), TIME fails because it expects 0-23 hours. Instead, convert to seconds: hours3600+minutes60+seconds, then divide by 86400 to store as a true Excel time.
Tips and Best Practices
- Always inspect source formatting using the VALUE or ISTEXT functions before writing complex formulas.
- Apply a custom format “[h]:mm:ss” on parsed cells; this preserves correct display when results exceed 24 hours.
- Use structured references (tables) so formulas auto-fill when new rows arrive, eliminating manual copy-down.
- For perpetual workflows (weekly imports), replace formula solutions with Power Query steps to reduce workbook size and recalculation overhead.
- Store raw text strings in a hidden sheet and place cleaned outputs in a separate sheet to reduce accidental edits.
- Document formulas with cell comments or the N() annotation trick to help future users understand the parsing logic.
Common Mistakes to Avoid
- Failing to format results: users often see decimals like 0.58 and assume conversion failed, when it simply needs Time formatting.
- Using VALUE on locale-specific strings that conflict with your regional settings (for example, commas instead of colons). Test with a few samples first.
- Forgetting to lock references (adding $ signs) when copying formulas across multiple columns, causing TIME(VALUE(LEFT(A2,2)), …) to shift unexpectedly.
- Ignoring error checking: unparsed rows silently cause downstream calculations to output zero or error values. Wrap formulas in IFERROR or use conditional formatting to flag blanks.
- Mixing date arithmetic with time durations greater than 24 hours—TIME cannot handle hours ≥ 24; use pure number math divided by 24-hours-per-day instead.
Alternative Methods
Different circumstances call for different tools.
| Method | Best for | Pros | Cons |
|---|---|---|---|
| TIMEVALUE | Simple \"hh:mm\" or \"hh:mm:ss\" text | One function, region-aware, fast | Cannot handle extra letters, fails on >24h durations |
| VALUE | Text that looks like date-space-time | Keeps both date and time, minimal setup | Locale sensitive, spaces must be present exactly |
| LEFT/MID/RIGHT + TIME | Fixed-width strings like \"075530\" | Full control over each component | Lengthy formulas, maintenance heavy |
| TEXTSPLIT + TIME (365) | Irregular delimiters e.g., \"02h37m45s\" | Dynamic arrays, minimal helper columns | Requires 365 or Excel for web |
| Power Query | Large CSV imports, automation | No formulas, refreshable, handles many formats | Learning curve, data lives in query tables |
| VBA | Legacy automation | Runs in older Excel, can loop custom logic | Macros disabled in many environments, maintenance risk |
Select based on version, data size, refresh frequency, and team skill level. Migration tip: start with formulas for prototyping, then upgrade to Power Query once requirements stabilize.
FAQ
When should I use this approach?
Use formula-based parsing for ad-hoc analysis, quick prototypes, or when sharing with users uncomfortable with Power Query. Use Power Query or VBA for scheduled processes, large datasets, or when you need an auditable transformation pipeline.
Can this work across multiple sheets?
Yes. Simply reference the source cell with a sheet qualifier like Sheet1!A2. If you use structured tables, you can point formulas on the output sheet to Table1[RawTime] and results will update automatically.
What are the limitations?
TIMEVALUE and TIME cannot process hours ≥ 24. VALUE fails when the string contains nonstandard characters. TEXTSPLIT requires Excel 365. Older Excel (pre-2007) has row limits that restrict massive imports.
How do I handle errors?
Wrap each parsing formula in IFERROR and redirect errors to blank (\"\") or a descriptive flag. For deeper diagnostics, use IF(ISNUMBER(result),\"OK\",\"CHECK\"). In Power Query, add a “Changed Type With Locale” step to trap incompatible rows.
Does this work in older Excel versions?
TIMEVALUE, VALUE, LEFT, MID, and RIGHT date back to Excel 97, so core parsing works everywhere. TEXTSPLIT, TEXTBEFORE, TEXTAFTER are exclusive to Excel 365. Power Query is native from Excel 2016 onward (and available as an add-in for 2010/2013).
What about performance with large datasets?
Volatile formulas recalculate frequently; prefer non-volatile parsing or convert results to static values once validated. Power Query is columnar and highly efficient: 100 000+ rows often load in seconds. Avoid array formulas that spill across large ranges unless necessary.
Conclusion
Parsing time strings to genuine Excel times is a foundational data-cleaning skill that unlocks reliable calculations, insightful analysis, and professional-grade dashboards. Whether you lean on the simplicity of TIMEVALUE, the flexibility of VALUE, the precision of string functions, or the power of modern TEXTSPLIT and Power Query, mastering these techniques elevates your productivity and credibility. Continue experimenting with varied sources, practice handling edge cases, and soon converting any quirky timestamp will feel routine—one more step toward Excel mastery.
Related Articles
How to Show the 10 Most Common Text Values in Excel
Learn multiple Excel methods to list the 10 most frequent text values—complete with step-by-step examples, business use cases, and expert tips.
How to Abbreviate Names Or Words in Excel
Learn multiple Excel methods to abbreviate names or words with step-by-step examples and practical applications.
How to Abbreviate State Names in Excel
Learn multiple Excel methods to abbreviate state names with step-by-step examples, professional tips, and real-world applications.