Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
carl
 
Posts: n/a
Default Working w/ non-standard Time Format

My time data comes in as so:

103058
103101

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

Thank You in advance.
  #2   Report Post  
Trevor Shuttleworth
 
Posts: n/a
Default

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" wrote in message
...
My time data comes in as so:

103058
103101

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

Thank You in advance.



  #3   Report Post  
Fredrik Wahlgren
 
Posts: n/a
Default


"carl" wrote in message
...
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove time from a date and time field? Format removes the displa. oaoboc Excel Worksheet Functions 1 February 16th 05 07:20 PM
Custom Time Format doesn't work for me chuck Excel Discussion (Misc queries) 1 February 13th 05 04:12 AM
I cannot get time format to display in a drop-down list Mighty Mike Excel Discussion (Misc queries) 0 February 1st 05 09:47 PM
entering numbers to display a time format Ian Williams/Eazygig Excel Discussion (Misc queries) 1 January 10th 05 11:57 AM
Time Format Auto Entry AM and PM BulaMan Excel Discussion (Misc queries) 1 December 15th 04 09:30 AM


All times are GMT +1. The time now is 07:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"