I'm 99% sure that will make them Text, and as they stand you can't do simple math or formatting with them
A UDF is probably required in order to easily calculate. Try the attachment
The code could be made more modular (and probably more clever-er) but I went with the more straight forward approach
Option Explicit
'If the days are the same,
'If End time > Start time, then
' Result = End time - Start time.
'Else
'Result = (6 * 24) + (24 - (Start time - End Time))
' Endif
'Else
'Result = (24 * number of whole days between date times) + (24 - Start time) + (End time)
'Endif
Function NumberOfHours(STime As String, ETime As String) As Double
Const cDay As Long = 0
Const cTime As Long = 1
Const cAMPM As Long = 2
Const cDays As String = "MONTUEWEDTHUFRISATSUNMONTUEWEDTHUFRISATSUN"
Dim vStart As Variant, vEnd As Variant
Dim sDayStart As String, sDayEnd As String
Dim dTimeStart As Double, dTimeEnd As Double
Dim iDayStart As Long, iDayEnd As Long, iNumDays As Long
vStart = Split(STime, " ")
sDayStart = UCase(vStart(cDay))
'need the 'extra' ( ) around the parameters to coerce the type
dTimeStart = HHMM2DecimalHours((vStart(cTime)), (vStart(cAMPM)))
vEnd = Split(ETime, " ")
sDayEnd = UCase(vEnd(cDay))
'need the 'extra' ( ) around the parameters to coerce the type
dTimeEnd = HHMM2DecimalHours((vEnd(cTime)), (vEnd(cAMPM)))
If vStart(cDay) = vEnd(cDay) Then
If dTimeEnd > dTimeStart Then
NumberOfHours = dTimeEnd - dTimeStart
Else
NumberOfHours = (6# * 24#) + (24# - (dTimeStart - dTimeEnd))
End If
Else
iDayStart = InStr(cDays, sDayStart)
iDayEnd = InStrRev(cDays, sDayEnd)
iNumDays = ((iDayEnd - iDayStart) / 3) - 8
NumberOfHours = (24# * iNumDays) + (24# - dTimeStart) + dTimeEnd
End If
End Function
Private Function HHMM2DecimalHours(S As String, AMPM As String) As Double
Dim i As Long
Dim s1 As String
Dim d As Double
s1 = Trim(S)
i = InStr(s1, ":")
If i = 0 Then
d = CDbl(s1)
Else
d = CDbl(Left(s1, Len(s1) - i - 1)) + CDbl(Right(s1, Len(s1) - i)) / 60#
End If
If UCase(AMPM) = "PM" Then d = d + 12
HHMM2DecimalHours = d
End Function