I mostly do VBA and not formulas, but I think that IF, AND, and OR might work
Using the formula in the Hours Column (P):
=MOD((H6-G6)+(J6-I6)+(L6-K6)+(N6-M6),1)
looking at each shift pair
"(H6-G6)" and "(J6+I6)" and etc
For the day shift total
HTML Code:
MOD((IF(AND(H6>5:59,H6<22:00),H6-G6,0))+Next shift pair+etc)
For the night shift
HTML Code:
MOD((IF(OR(H6>21:59,H6<6:00),H6-G6,0))+Next shift pair+etc)
This assumes that the subshift belongs to the main shift in which it started. For example The 4th subshift of 3/12/2014, (21:50 to 22:20,) on your sheet belongs to the day shift. THis also means that a subshift from 21:59 to 6:01 the next day belongs to the day shift of the starting date.