Convert text to time

SimonHughes

Well-known Member
Joined
Sep 16, 2009
Messages
507
Office Version
  1. 365
Platform
  1. Windows
Hello All, is there any way to convert these times into a proper time format? TIA

GC TIME
28 m 34.846 s
31 m 1.347 s
31 m 11.698 s
31 m 38.859 s
32 m 8.944 s
32 m 12.423 s
32 m 26.875 s
32 m 53.788 s
32 m 56.865 s
33 m
 
Just noting that if you change both of the A2 references in the formula you marked as the answer to A2:A11, it will generate the entire output from that one single formula (no copying down will be necessary)...

=TEXTBEFORE(A2:A11,"m")/(60*24)+IFERROR(TEXTAFTER(TEXTBEFORE(A2:A11,"s"),"m ")/(24*60*60),0)

Also, here is a shorter alternative solution that will also generate the entire output from a single formula (again, no copying down needed)...

=0+SUBSTITUTE(SUBSTITUTE("00:"&A2:A11&" "," m ",":")," s","")
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Glad we could help. Thanks for the feedback.
Follow up question which I should have anticipated. The data now includes the hours count as shown (hrs). I have tried to adjust the formulas you have all provided but with no success - can you please help? Many thanks
Problem you solved and new problem shown
23 m 17.747 s
1 hrs, 54 m 54.824 s
 
Upvote 0
Glad we could help. Thanks for the feedback.
More feedback Felix, the data now includes hrs (hours) which I should have anticipated. I have tried working this into the formulas provided but without success, can you help (again), many thanks
Original problem32 m 26.875 s
New problem1 hrs, 32 m 46.804 s
 
Upvote 0
Just noting that if you change both of the A2 references in the formula you marked as the answer to A2:A11, it will generate the entire output from that one single formula (no copying down will be necessary)...

=TEXTBEFORE(A2:A11,"m")/(60*24)+IFERROR(TEXTAFTER(TEXTBEFORE(A2:A11,"s"),"m ")/(24*60*60),0)

Also, here is a shorter alternative solution that will also generate the entire output from a single formula (again, no copying down needed)...

=0+SUBSTITUTE(SUBSTITUTE("00:"&A2:A11&" "," m ",":")," s","")
Hello Rick, the data now contains different content (which I should have anticipated) - could you be so kind as to tweak your solution for that?

Original problem32 m 26.875 s
New problem1 hrs, 32 m 46.804 s
 
Upvote 0
try the following

Time.xlsm
ABC
1
223 m 17.747 s0:23:17.7470:23:17.747
31 hrs, 54 m 54.824 s1:54:54.8241:54:54.824
3dd
Cell Formulas
RangeFormula
B2:B3B2=--IF(LEN(A2)>13,TEXTJOIN(":",,TEXTSPLIT(A2,{"hrs,","m","s"})),TEXTJOIN(":",,TEXTSPLIT(A2,{"m","s"})))
C2:C3C2=--IF(ISERROR(FIND("h",A2)),TEXTJOIN(":",,TEXTSPLIT("0h"&A2,{"h","m","s"})),TEXTJOIN(":",,TEXTSPLIT(A2,{"hrs,","m","s"})))
 
Upvote 0
try the following

Time.xlsm
ABC
1
223 m 17.747 s0:23:17.7470:23:17.747
31 hrs, 54 m 54.824 s1:54:54.8241:54:54.824
3dd
Cell Formulas
RangeFormula
B2:B3B2=--IF(LEN(A2)>13,TEXTJOIN(":",,TEXTSPLIT(A2,{"hrs,","m","s"})),TEXTJOIN(":",,TEXTSPLIT(A2,{"m","s"})))
C2:C3C2=--IF(ISERROR(FIND("h",A2)),TEXTJOIN(":",,TEXTSPLIT("0h"&A2,{"h","m","s"})),TEXTJOIN(":",,TEXTSPLIT(A2,{"hrs,","m","s"})))
Haha Dave, both are perfect - thank you so much. Between posting my question and getting your reply, I wondered if Power Query would fix it - so I am going to give that a bash now and will post afterwards.
 
Upvote 0
Is post #17 the final result answer or #15+#17 together? I dont see any difference in the result outputs.
 
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,352
Members
453,033
Latest member
lapmangviettel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top