Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to convert time string to time in Excel?

For instance, you have a list of text string in a worksheet, and now you need to convert these text strings to time or date and time, how can you solve it? Here I will introduce some tricks for you to quickly convert text string to time in Excel.

Convert text string to time

Convert text string to date and time


arrow blue right bubble Convert text string to time


To convert text string to time, you can use some formulas to solve.

Kutools for Excel, with more than 120 handy Excel functions, enhance your working efficiency and save your working time.

1. Select a cell and type this formula =TIMEVALUE(LEFT(A1,LEN(A1)-2)&":"&RIGHT(A1,2)) (A1 is the text string you need to convert to time) into it, and press Enter. If you need, you can drag the fill handle to the range you need. See screenshot:
doc-time-string-to-time-1

2. Then right click at these selected cells, and select Format Cells from the context menu, and then in the Format Cells dialog, select Time from the Category list under Number tab, then select the time type you need.
doc-time-string-to-time-2

3. Click OK, now text strings are converted to time.
doc-time-string-to-time-3

Note:

1. This formula cannot work correctly when text string including seconds, such as 120158.

2. If your text string format is 120456P, you can use this formula =TEXT(--(LEFT(A1,LEN(A1)-1)),"0\:00\:00")+((RIGHT(A1,1)="P")/2), then format the cells as the 12 hour clock you need. See screenshot:

doc-time-string-to-time-4
doc-time-string-to-time-5


arrow blue right bubble Convert text string to date and time

If your text string includes date and time such as 20141212 0312, you can use a little long formula to solve.

1. In the blank cell, type this formula =DATE(LEFT(A1,4),MID(A1,5,2),MID(A1,7,2))+TIME(MID(A1,10,2),RIGHT(A1,2),0), and then press Enter key, if you need, you can apply this formula to a range.

2. Then right click at the selected cells and select Format Cells from context menu, then in the Format Cells dialog, select Date from the Category list, and select the type you need from right section.
doc-time-string-to-time-6

3. Click OK. Now you can see the text string converted to date and time.
doc-time-string-to-time-7

Tip.If you want to convert a time to decimal hours, minutes or seconds, please try to use the Kutools for Excel’s Convert Time as shown in the following screenshot. It’s full function without limitation in 60 days,

Convert Time

Kutools' Convert Time utility can quickly convert a time to decimal hours, minutes, seconds.
doc convert time 1
Time to decimal hours
Time to decimal minutes
Time to decimal seconds
doc convert time 2
doc convert time 3
doc convert time 4


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Mukul Aggarwal · 4 months ago
    Hi.,I have a query.
    I want to convert a duration extracted in a format #h #m #s to duration format so that I can filter it. For example:
    My data has a field named Session Duration and the format of the cell is "General" and the cell says "1h 2m 15s". I need to convert this data into 01:02:15 but not in time format but a duration. Is there a way to do that.
  • To post as a guest, your comment is unpublished.
    ruben · 4 months ago
    =A1/(24*60) (algebra methods)..hahhaha
    then apply time format
  • To post as a guest, your comment is unpublished.
    Gabriel · 5 months ago
    How can I convert 1 Hour 35 Min 25 Sec, stored as a text format into Hour format (hh:nn:ss)?
    • To post as a guest, your comment is unpublished.
      Sunny · 3 months ago
      Hi, Gabriel, you can try this formula =TIME(LEFT(K4,1),MID(K4,8,2),MID(K4,15,2)) K4 is the cell contains text you want to convert, then format the result as time.
  • To post as a guest, your comment is unpublished.
    Ayaan · 9 months ago
    2h 50m how do i convert into 2:50
    • To post as a guest, your comment is unpublished.
      Sunny · 9 months ago
      Hi, Ayaan, you can try Find and Replace function, h (blank) replace wth : , m replace with nothing
  • To post as a guest, your comment is unpublished.
    Syd Azhar · 1 years ago
    using the [ =TEXT(--(LEFT(A1,LEN(A1)-1)),"0\:00\:00")+((RIGHT(A1,1)="P")/2) ] formula,
    in example #2 above, 123706A >> gets converted to 12:37:06 PM (instead of 12:37:06 AM)
    how may this be rectified?
    • To post as a guest, your comment is unpublished.
      Sunny · 1 years ago
      You only need to change the P to A in the formula =TEXT(--(LEFT(A1,LEN(A1)-1)),"0\:00\:00")+((RIGHT(A1,1)="A")/2), the format the formula cell as hh:mm:ss AM/PM
      • To post as a guest, your comment is unpublished.
        Syd Azhar · 1 years ago
        so if you enter 35943A you get 3:59:43 AM (which is great).
        but if you enter 123706A you would expect to get 12:37:06 AM but instead you get 12:37:06 PM (which is not so great).
        also if you enter 123706P you get 12:37:06 AM (again expecting to get 12:37:06 PM).
        the meridiem are only incorrect for 12xxxx, formula works flawlessly for 1~11.
        any way to improve the formula, to be all encompassing? thank you
  • To post as a guest, your comment is unpublished.
    Syd · 1 years ago
    using the [ =TEXT(--(LEFT(A1,LEN(A1)-1)),"0\:00\:00")+((RIGHT(A1,1)="P")/2) ] formula,
    in example #2 above, 123706A >> gets converted to 12:37:06 PM (instead of 12:37:06 AM)
    how may this be rectified?
  • To post as a guest, your comment is unpublished.
    heena · 2 years ago
    it is not looking like short cut...I want the short cut for converting the data into time without using mouse
    • To post as a guest, your comment is unpublished.
      Sunny · 2 years ago
      Hello, if you need shortcut to convert number string to time, you can hold Shit+Ctrl and press @ keys.