Hi guys

I have a situation where i have to calculate working hours. The working hours at my office are 7.5 hours excluding lunch break (1pm-2pm) and tea time (4pm-4:30pm) (start working at 8:30am). What i want is to calculate the working hours for a person. Let say total time to finish a machine are 18hours and i start working at 4.30pm and my office end work at 5:30pm so my working hours are only 1 hour and my remaining 17 hour will continue tomorrow. Is there any formula to make a limit for counting? What I mean with the limit is that the formula will count start from 4:30 until the limit (5:30pm). If i start at 3:30pm it will jump the tea time and count hours until 5:30pm. So, is there any formula to calculate situation like this?