Hello
Apart from the error you're seeing which can be easily suppressed by appropriate IF() statement, you should be very careful when processing time value in Numbers. Actually there's NO time-only value but always date-time value in Numbers. And worse, if you input time without date, date is assumed to be the date of the input.
I'd classify it as bug or bug-like behaviour of the application because if you input date without time, the time is assumed to be 00:00:00 and not the time of the input. Therefore the expected behaviour of time input is that if you input time without date, the date should be assumed to be the constant epoch date, which is 1904-01-01, and not the date of the input. If user inputs time without date, date part should be assumed to be null or at least some constant value.
But the application behaves differently. The problem would arise when, for instance, you edit the quasi time-only value on a later date and the calculation yields unexpected result. Since you're not showing date part of the date-time value in question, it would be hard to realise the cause of the problem.
Reasonable workarounds would be a) to use TIMEVALUE() function to extract the true time-only value from date-time value or b) to use special time notation, such as HHMM instead of HH:MM, which Numbers does not interpret as date-time value.
E.g. a) using TIMEVALUE():
Table 1
A1 date
A2 2015-07-01
A3 2015-07-02
A4 2015-07-03
A5 2015-07-04
A6 2015-07-05
A7 2015-07-06
A8
B1 in
B2 2015-07-21 07:30:00
B3 2015-07-21 08:00:00
B4 2015-07-21 13:00:00
B5 2015-07-21 14:00:00
B6
B7 2015-07-21 07:00:00
B8
C1 out
C2 2015-07-21 14:30:00
C3 2015-07-21 17:00:00
C4 2015-07-21 00:15:00
C5 2015-07-21 02:00:00
C6
C7 2015-07-21 12:00:00
C8
D1 hours
D2 =DURATION(,IF(LEN(B2)*LEN(C2)>0,MOD(TIMEVALUE(C2)-TIMEVALUE(B2)+1,1),0))
D3 =DURATION(,IF(LEN(B3)*LEN(C3)>0,MOD(TIMEVALUE(C3)-TIMEVALUE(B3)+1,1),0))
D4 =DURATION(,IF(LEN(B4)*LEN(C4)>0,MOD(TIMEVALUE(C4)-TIMEVALUE(B4)+1,1),0))
D5 =DURATION(,IF(LEN(B5)*LEN(C5)>0,MOD(TIMEVALUE(C5)-TIMEVALUE(B5)+1,1),0))
D6 =DURATION(,IF(LEN(B6)*LEN(C6)>0,MOD(TIMEVALUE(C6)-TIMEVALUE(B6)+1,1),0))
D7 =DURATION(,IF(LEN(B7)*LEN(C7)>0,MOD(TIMEVALUE(C7)-TIMEVALUE(B7)+1,1),0))
D8 =SUM(D)
E.g. b) using HHMM notation:
Table 2
A1 date
A2 2015-07-01
A3 2015-07-02
A4 2015-07-03
A5 2015-07-04
A6 2015-07-05
A7 2015-07-06
A8
B1 in
B2 730
B3 800
B4 1300
B5 1400
B6
B7 700
B8
C1 out
C2 1430
C3 1700
C4 15
C5 200
C6
C7 1200
C8
D1 hours
D2 =DURATION(,,IF(LEN(C2)*LEN(B2)>0,MOD(INT(C2/100)+MOD(C2,100)/60-INT(B2/100)-MOD(B2,100)/60+24,24),0))
D3 =DURATION(,,IF(LEN(C3)*LEN(B3)>0,MOD(INT(C3/100)+MOD(C3,100)/60-INT(B3/100)-MOD(B3,100)/60+24,24),0))
D4 =DURATION(,,IF(LEN(C4)*LEN(B4)>0,MOD(INT(C4/100)+MOD(C4,100)/60-INT(B4/100)-MOD(B4,100)/60+24,24),0))
D5 =DURATION(,,IF(LEN(C5)*LEN(B5)>0,MOD(INT(C5/100)+MOD(C5,100)/60-INT(B5/100)-MOD(B5,100)/60+24,24),0))
D6 =DURATION(,,IF(LEN(C6)*LEN(B6)>0,MOD(INT(C6/100)+MOD(C6,100)/60-INT(B6/100)-MOD(B6,100)/60+24,24),0))
D7 =DURATION(,,IF(LEN(C7)*LEN(B7)>0,MOD(INT(C7/100)+MOD(C7,100)/60-INT(B7/100)-MOD(B7,100)/60+24,24),0))
D8 =SUM(D)
Notes.
In both tablse, row 1 is header row and row 8 is footer row.
Formulae in Table 1::D2 and Table 2::D2 can be filled down across D2:D7.
Tables are built with Numbers v2.
Good luck,
H