Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Is there a command - or easy way to add minutes and seconds (rather than converting everything to seconds etc.) ? Thanks - Kirk |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Answering my own question!
Did no one esle know, or was it so obvious as to be a silly question ? :) Anyway this seems to work, but there maybe some glitch not envisaged. Any comments, criticisms welcome! -- Function AddTimes(ByVal t1, t2) 'Adds MINS and SECS ' format "02:50" , "03 45", "4:33" etc Dim t1s, t2s, tt t1s = Split(t1, " ") If UBound(t1s) < 1 Then t1s = Split(t1, ":") t2s = Split(t2, " ") If UBound(t2s) < 1 Then t2s = Split(t2, ":") tt = TimeSerial(0, t1s(0), t1s(1)) + TimeSerial(0, t2s(0), t2s(1)) If Val(Format(tt, "hh")) = 0 Then AddTimes = Format(tt, "nn:ss") Else AddTimes = Format(tt, "hh:nn:ss") End If End Function -- I wanted it to handle various Minutes and Seconds formats and it doesn't check for bad input as there shouldn't be any ! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding time | Excel Worksheet Functions | |||
Adding time AM/PM | Excel Discussion (Misc queries) | |||
Adding Time | Excel Worksheet Functions | |||
Time log adding time from separate sheets | New Users to Excel | |||
Adding time to date-time formatted cell | Excel Discussion (Misc queries) |