Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
time to seconds
I have a spreadsheet which contains time information like follwoing
format 0h 15m 35s 7h 1m 5s and I would like to convert in seconds, Are there any functions or formula to do this? Your help is great appreciated, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
time to seconds
I made a custom function. Put this code into a standard module. I assumed
your hours, minutes, and seconds will have spaces between them. Plus I assumed it all will be in 1 cell. If your data is in A1 put this formula in B1 "=ConvertTime(A1)". See what happens. Hope this helps! If so, let me know, click "YES" below. Function ConvertTime(MyRange As Range) As String Dim MyArray As Variant MyArray = Split(MyRange) ConvertTime = Val(MyArray(0)) * 360 + Val(MyArray(1)) * 60 + Val(MyArray(2)) End Function -- Cheers, Ryan "inungh" wrote: I have a spreadsheet which contains time information like follwoing format 0h 15m 35s 7h 1m 5s and I would like to convert in seconds, Are there any functions or formula to do this? Your help is great appreciated, . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
time to seconds
I assume the following:-
These are not correctly formatted times They will all be in the format of your examples. Try this =(LEFT(A1,FIND("h",A1)-1)*3600)+(MID(A1,FIND(" ",A1)+1,FIND("m",A1)-(FIND(" ",A1)+1))*60)+(SUBSTITUTE(MID(A1,FIND(CHAR(7),SUBS TITUTE(A1," ",CHAR(7),2))+1,999),"s","")) all one line -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "inungh" wrote: I have a spreadsheet which contains time information like follwoing format 0h 15m 35s 7h 1m 5s and I would like to convert in seconds, Are there any functions or formula to do this? Your help is great appreciated, . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
time to seconds
Are those times as strings or time-values with a custom number-format. If
the latter multiply by (24*60*60) Regards, Peter T "inungh" wrote in message ... I have a spreadsheet which contains time information like follwoing format 0h 15m 35s 7h 1m 5s and I would like to convert in seconds, Are there any functions or formula to do this? Your help is great appreciated, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Time in Seconds Only | Excel Discussion (Misc queries) | |||
How do I change a minutes and seconds as a 2400 time to seconds? | Excel Worksheet Functions | |||
time in seconds | New Users to Excel | |||
how do i add seconds (time)? | Excel Worksheet Functions | |||
Convert "Time Interval" in "hours : minutes : seconds" to seconds | New Users to Excel |