Working w/ non-standard Time Format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My time data comes in as so:

103058
103101

Is there a formula that can tell me the difference ( 3seconds) ??

Thank You in advance.
 
Carl

one way:

=(LEFT(A4,2)*3600+MID(A4,3,2)*60+RIGHT(A4,2))-(LEFT(A3,2)*3600+MID(A3,3,2)*60+RIGHT(A3,2))

Regards

Trevor
 
carl said:
My time data comes in as so:

103058
103101

Is there a formula that can tell me the difference ( 3seconds) ??

Thank You in advance.

Here's a quick solution. Start your VBA editor and insert a new module. Then
paste this code:

Public Function TimeDiff(ByVal t1 As Long, ByVal t2 As Long) As Long
Dim s1 As Long
Dim s2 As Long

s1 = 3600 * CLng(Left(CStr(t1), 2))
s1 = s1 + 60 * CLng(Mid(CStr(t1), 3, 2))
s1 = s1 + CLng(Right(CStr(t1), 2))

s2 = 3600 * CLng(Left(CStr(t2), 2))
s2 = s2 + 60 * CLng(Mid(CStr(t2), 3, 2))
s2 = s2 + CLng(Right(CStr(t2), 2))

TimeDiff = s1 - s2
End Function

Best Regards,
Fredrik


/Fredrik
 

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

Back
Top