You could try

=IF(NETWORKDAYS(A1,B1)=1,(MIN(Z1,MOD(B1,1))-MAX(Y1,MOD(A1,1))),(NETWORKDAYS(A1,B1)-2)*(600/1440)+(Z1-MAX(MOD($A$1,1),Y1))+MIN(MOD($B$1,1),Z1)-Y1)

where

a1 is start time

b1 is stop time

y1 is start of day (8:00)

z1 is end of day (17:00)

You can certainly change y1 and z1 to defined names if you wish. I beleive this formula should work in all cases, except if the start time falls on a weekend. Please let me know if you find some instances it doesn't work and we can tweak it.

## Like this thread? Share it with others