Quote Originally Posted by mar_t
whenever there is no entries in Start and Stop cells the result is 8, would appreciate if you could set as zero
Given Times are numeric values you can add a pre-emptive COUNT test

=IF(COUNT(C2:D2)<2,0,MAX(0,MIN(D2,INT(C2)+1+"6:00")-MAX(C2,INT(C2)+"22:00")))