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

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

ThePencilQueen

Board Regular
Joined
Jun 26, 2002
Messages
109
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.
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
To convert a time value to seconds, use:

=A1*86400

where A1 houses the time value of interest like 09:23:17.
 

bbabine

New Member
Joined
Apr 28, 2002
Messages
47
Thanks Aladin, that is much simplier to work with. Could you provide me the number to multiply by for just min:secs? Thanks!!
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,089
Messages
5,857,297
Members
431,869
Latest member
Avinashz

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
Top