Converting time with text to columns correctly

bbabine

New Member
Joined
Apr 28, 2002
Messages
47
I am trying to convert time that I have in the following format xx:xx:xx to seconds. What I tried was using text-to-columns to put each time segment in their own column and remove the ":". I then do calculations that convert each column. For example the first column is hours so I use the following calculation - CONVERT(P2,"hr","sec"). The problem lies in when the hour time is greater than 12. When the time is for example 13:00:00, the text-to-columns command changes the 13 to a 1. Is there anyway to make sure that the 13 will stay a 13? I could have as many as 3 or 4 digit hour times (example: 111:35:25). Or is there a better way to convert this time to seconds. I have rows and rows of data that needs to be converted.

Any help would be greatly appreciated!!!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
If its split out into separate columns why not just do an old fashioned sum? (ie =(hrs*60)+(s)+(ms/whatever number of ms there is in a second))
This should give you a decimal giving the number of seconds.
 
Upvote 0
To convert a time value to seconds, use:

=A1*86400

where A1 houses the time value of interest like 09:23:17.
 
Upvote 0
Thanks Aladin, that is much simplier to work with. Could you provide me the number to multiply by for just min:secs? Thanks!!
 
Upvote 0
On 2002-09-26 09:12, bbabine wrote:
Thanks Aladin, that is much simplier to work with. Could you provide me the number to multiply by for just min:secs? Thanks!!

To convert a time value to decimal minutes:

=(A1*1440)

if that is what you're asking.
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,218
Members
448,554
Latest member
Gleisner2

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