Converting time from text to numeric

E

Eric Wixom

I have a column of time logs ranging from:

1:00:00:00
to
0:01

I need to split this into days, hours, minutes, and seconds. They are not
the same length so LEFT or RIGHT functions wont work, and I am not savvy
enough in VB to program the split.

Any suggestions?
 
D

David Biddulph

If they are *text* as your subject line says, then use Data/ Text to
Columns/ Delimited, and specify the colon as delimiter.
 
E

Eric Wixom

I didn't explain it will, sorry. the values are coming from a counter, it
starts at 0:01 and then when it hits 23:59:59 it will roll over to 1:00:00:00

Excel is not recognixing it as time, so I can't use TIMEVALUE or similar
functions to break it down. Excel is recognizing it as text. I need to be
able to get Excel to recognize the Day, Hour, Minute, and Second. I know in
programing you would use a split function, does Excel have something similar?
 
F

Fred Smith

You can do this in two steps. One, force your data to be consistently
d:hh:mm:ss, using:

=RIGHT("0:00:00:"&IF(OR(LEN(A1)=4,LEN(A1)=7),"0","")&A1,10)

Second, convert to days plus time:

=LEFT(A2,1)+TIMEVALUE(RIGHT(A2,8))

This will work for up to 10 days. You can display it using a format like: d
hh:mm:ss

Is this good enough?

Regards,
Fred.
 
E

Eric Wixom

Fantastic! Thank you!
I had to add LEN=5 and LEN=8 to the formula to make it come out right for
all the different times, but it works great.

The TIMEVALUE is not working correctly though, I don't know why yet. I will
play with it but you won half the battle for me.

Thanks again,
Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Subtracting time...again 2
Conditional Time Calculation 10
Payment calculation 1
Convert times to text string 3
Convert time to text 4
Lookups 1
time converting 3
Imported time text to seconds 7

Top