## 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

#### Convert text string to time

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

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:

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.

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

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:

#### 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.

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

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 30 days, please download and have a free trial now.

#### Quickly convert time to decimal value in Excel

For example, you have a list of time needed to be converted todecimal hours, minutes or seconds, how can you quickly and easily solve it in Excel? The Convert Time of Kutools for Excel, can do a favor for you.   Click for 30 days free trial!

### Best Office Productivity Tools

 🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions… Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ... Super Lookup: Multiple Criteria VLookup  |   Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup .... Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List .... Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ... Featured Features: Grid Focus   |  Design View   |   Big Formula Bar   |  Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells   |  Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ... Top 15 Toolsets:  12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

#### 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!
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Would love any help with this. I have data that is reported as "1d 01h 01m" representing 1 day, 1 hour, 1 min and I need to be able to represent this as a single number (preferably in # of minutes) any thoughts on how I can convert this string to a number value? Thanks all!
This comment was minimized by the moderator on the site
how to convert 06Hr:11Mi into 06:11
This comment was minimized by the moderator on the site
Hi, abinash kumar, you can remove alpha characters from your time string.
How to remove alpha characters from cells in Excel?
This comment was minimized by the moderator on the site
how do I convert Date/Time with this text format 08/07/2022 1519
This comment was minimized by the moderator on the site
Hi, Tina, please give me a specific example for explaining and descriping your problem. Thank you.
This comment was minimized by the moderator on the site
Hi there!

I used one of formulas above to convert a time string and it worked beautifully expect for anything that had a format of 1200P. It should convert to 12:00 but instead converts to 00:00. Any thoughts on why or how to fix it?

I used: "120456P, you can use this formula =TEXT(--(LEFT(A1,LEN(A1)-1)),"0\:00\:00")+((RIGHT(A1,1)="P")/2)"

I did not have any seconds in my time string so I deleted the last set of 0's in the formula and it still worked.
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
=A1/(24*60) (algebra methods)..hahhaha
then apply time format
This comment was minimized by the moderator on the site
How can I convert 1 Hour 35 Min 25 Sec, stored as a text format into Hour format (hh:nn:ss)?
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
2h 50m how do i convert into 2:50
This comment was minimized by the moderator on the site
Hi, Ayaan, you can try Find and Replace function, h (blank) replace wth : , m replace with nothing
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
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
This comment was minimized by the moderator on the site
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
This comment was minimized by the moderator on the site
It is a little complex, sorry I cannot help you. Maybe someone in our forum https://www.extendoffice.com/forum.html can help you if you place the question in it.
This comment was minimized by the moderator on the site
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?
There are no comments posted here yet
Posting as Guest
Rate this post:
0   Characters
Suggested Locations