Sorry I had an extra AND in that formula that should be there, this is the correct version
=IF(COUNT(A2,B2)=2,AND(OR(A2*24>=20,B2*24<=6),MEDIAN(1-A2,0,"4:00")+MEDIAN(B2,0,"6:00")>=MOD(B2-A2,1)/2),"")
should cope with any shift
regards, barry