Can you explain how you get 50 minutes?Column 1: hhmmss (223000)
Column 2: hhmmss (234000)
Now, how can I get the difference between them?
It would be 50min (5000).
? Format((234000-223000)/86400,"hh:nn:ss")
Result: 03:03:20
I think that is because you are neglecting the date portion of these cells (they are always there, whether you make that part visible or not).
If you temporarily format your cells to show the date value along with the time value, what do those two cells show?
Public Function hhmmss(ByVal num1 As Long, ByVal num2 As Long) As String
Dim x As Double, y As Double, Z as long
Z = 86400
x = Eval(Left(num1, 2) * 3600 + Mid(num1, 3, 2) * 60 + Right(num1, 2)) / Z
y = Eval(Left(num2, 2) * 3600 + Mid(num2, 3, 2) * 60 + Right(num2, 2)) / Z
hhmmss = Format(y - x, "hh:nn:ss")
End Function
[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #C0C0C0"][/TD]
[TD="bgcolor: #C0C0C0"]A[/TD]
[TD="bgcolor: #C0C0C0"]B[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]2[/TD]
[TD]220300[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]3[/TD]
[TD]223500[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]4[/TD]
[TD="bgcolor: #CCFFCC"]3200[/TD]
[TD="bgcolor: #CCFFCC"]A4: =--(TEXT(TEXT(A3, "00\:00\:00") - TEXT(A2, "00\:00\:00"), "hhmmss"))[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]5[/TD]
[TD][/TD]
[TD]Format of A4: General[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]7[/TD]
[TD]223000[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]8[/TD]
[TD]234000[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]9[/TD]
[TD="bgcolor: #CCFFCC"]11000[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]