# Excel: Count working hours between 2 dates excl weekends either with formula or function

Hey all, I know I can find the answer to my question on quite a few places but I've tried most I find and they just don't work. Don't mind if its a formula or function though. example of what I tried for example is: =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) A1 is start time B1 is stop time Y1 is start of work day (8:00) Z1 is end of work day (17:00) (Thinking it does not work because of the starttime and endtime is difference, that it covers 2 days in a way, 2pm-3am) My issue is that our starting time is 2PM and end time is 3AM and the solutions I've found just do not work at all. I was thinking either a function which does =TimeDiff(Date/timeStart, Date/timeEnd) or just link to a start date and end date in a formula. I need the code/formula to exclude weekends completely. Any ideas guys? Hoping someone can help me out here! Best regards Christian