Excel 函數自己用VBA寫
=TimeDiff(Stime, Etime)
' 計算時間範圍差距
Function TimeDiff(STime As Date, ETime As Date) As String
'DateDiff 的 Interval表示
'--------------------------
'Interval | Explanation
'--------------------------
'yyyy | Year
'q | Quarter
'm | Month
'y | Day of year
'd | Day
'w | Weekday
'ww | Week
'h | Hour
'n | Minute
's | Second
TimeDiff = Int(DateDiff("n", STime, ETime) / 60) & "." & Int(DateDiff("n", STime, ETime) Mod 60)
End Function
' 計算時間範圍差距
Function TimeDiff(STime As Date, ETime As Date) As String
'DateDiff 的 Interval表示
'--------------------------
'Interval | Explanation
'--------------------------
'yyyy | Year
'q | Quarter
'm | Month
'y | Day of year
'd | Day
'w | Weekday
'ww | Week
'h | Hour
'n | Minute
's | Second
TimeDiff = Int(DateDiff("n", STime, ETime) / 60) & "." & Int(DateDiff("n", STime, ETime) Mod 60)
End Function
留言
張貼留言