Extracting the number of seconds from a variable text string

JohnR99

New Member
Joined
Oct 2, 2011
Messages
7
I have a column of cells, each with a with text string that has three possible formats where I want to extract the total number of seconds.

The three formats are:

nnn hrs nn min nn sec (example: 1 hrs 42 min 58 sec)
or
nn min nn sec (example: 55 min 1 sec)
or
nn sec (example: 10 sec)

The result I want is a numeric value of the total number of seconds in the text string.

For example a text string of: 1 hrs 42 min 58 sec

Should give the result: (1 x 3600) + (42 x 60) + 58 = 6,178

Any help would be appreciated.
Thanks
John
 
After additional checking: incorrect results if "min" is missing – for such example "1 hrs 11 sec".<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hello.

My last try ...:
Excel Workbook
AB
11 sec1
21 min 1 sec61
31 min 01 sec61
41 hrs 10 sec3,610
510 hrs 1 min 1 sec36,061
6111 hrs 1 min 1 sec399,661
Sheet
 
Upvote 0
Barry's formula was awesome (no surprises there) - the following amendment takes account of no seconds in the calc:

=SUM(MID(0&A3&"000",FIND({"h","m","se"},A3&"xxxhmse")-2,2)*{3600,60,1})
 
Upvote 0

Forum statistics

Threads
1,215,436
Messages
6,124,869
Members
449,192
Latest member
MoonDancer

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