i encountered a similar issue. Only 16 hours were worked on a day and only a max of 5 hours were worked on Saturdays if at all worked. Saturdays are extremely rare and I haven't got Saturday fully worked out if the time starts or ends on Saturday. We aren't billing from this, just capturing time that equipment is on a bench for configuration. I am going to post the formula but be warned it is ugly but it could help you get on the right path to a solution.
var date startdate = ToDate([Start]);
var date enddate = ToDate([End]);
var number completeduration = ToHours([End]-[Start]);
var number startdayofweek = DayOfWeek($startdate);
var number enddayofweek = DayOfWeek($enddate);
var TimeOfDay alldaysstart = ToTimeOfDay("07:00");
var TimeofDay weekdaystop = ToTimeOfDay("23:00");
var TimeofDay saturdaystop = ToTimeOfDay("12:00");
// was worked logged on Saturday
var Bool worksaturday = If([Work Saturday]=true,true,false);
// time from noon Saturday to 7am Monday plus 11pm Friday to 7am Saturday 51 - now like below minus the 5 from Saturday
var number weekendhours = 43;
// 11pm Friday to 7am Monday 56 midnight saturday start to midnight Monday 48
var number noweekendhours = 48;
//weekend hours to subtract
var number unworkedweekendhours= If($worksaturday=true,$weekendhours,$noweekendhours);
// Length of a workday
var number workhours=16;
// length of non-workday
var number nonworkhours=8;
// did we start on Saturday?
var Bool startonweekend = If($startdayofweek=6,true,false);
// did we complete work on Saturday
var Bool endonweekend = If($enddayofweek=6,true,false);
var Bool startorendonweekend = If($startonweekend=true,true,If($endonweekend=true,true,false));
// did work happen on sameday?
var Bool sameday = If($startdate=$enddate,true,false);
// number of full days of work **adjusted
var number fulldaysofwork =ToDays($enddate-$startdate)-1;
// total days of work
var number alldaysofwork =ToDays($enddate-$startdate)+1;
var number alldaystotalhours = $alldaysofwork*24;
// hours not worked on start date
var number hoursonstart = 24-ToHours(ToTimestamp($startdate,$weekdaystop)-[Start]);
// hours not worked on start date saturday
var number saturdayhoursonstart = 24-ToHours(ToTimestamp($startdate,$saturdaystop)-[Start]);
// hours not worked on end date
var number hoursonend = 24-ToHours([End]-ToTimestamp($enddate,$alldaysstart));
// combined hours of start and end date hours not worked if not on weekend
var number workdayhoursnotworked = $hoursonstart+$hoursonend;
// combined hours of start and end date hours not worked if on saturday
var number workdayhoursnotworkedsat = If($startorendonweekend=true,$saturdayhoursonstart+$hoursonend,0);
//start and end dates
// Start what day of week
var Bool mstart = If($startdayofweek=1,true,false);
var Bool tustart = If($startdayofweek=2,true,false);
var Bool wstart = If($startdayofweek=3,true,false);
var Bool thstart =If($startdayofweek=4,true,false);
var Bool fstart =If($startdayofweek=5,true,false);
// End what day of the week
var Bool mend = If($enddayofweek=1,true,false);
var Bool tuend = If($enddayofweek=2,true,false);
var Bool wend = If($enddayofweek=3,true,false);
var Bool thend =If($enddayofweek=4,true,false);
var Bool fend =If($enddayofweek=5,true,false);
// not a full week but must remove weekend hours
var Bool meekone = If($mend=true and $tustart=true,true,false);
var Bool meektwo = If($mend=true and $wstart=true,true,false);
var Bool meekthree = If($mend=true and $thstart=true,true,false);
var Bool meekfour = If($mend=true and $fstart=true,true,false);
var Bool meek = If($meekone=true or $meektwo=true or $meekthree=true or $meekfour=true, true, false);
var Bool tueekone = If($tuend=true and $wstart=true,true,false);
var Bool tueektwo = If($tuend=true and $thstart=true,true,false);
var Bool tueekthree = If($tuend=true and $fstart=true,true,false);
var Bool tueek = If($tueekone=true or $tueektwo=true or $tueekthree=true, true, false);
var Bool weekone = If($wend=true and $thstart=true,true,false);
var Bool weektwo = If($wend=true and $fstart=true,true,false);
var Bool week = If($weekone=true or $weektwo=true, true, false);
var Bool theek = If($thend=true and $fstart=true,true,false);
var Bool shortweekremoveweekend = If($meek=true or $tueek=true or $week=true or $theek=true, true,false);
// Calulation to determine the number of weekends
var number fullweeks =
If($alldaysofwork>41,6,
If($alldaysofwork>34,5,
If($alldaysofwork>27,4,
If($alldaysofwork>20,3,
If($alldaysofwork>13,2,
If($alldaysofwork>6,1,0))))));
var number weekenddays= $fullweeks*2;
var Number removeshortweekhours = If($shortweekremoveweekend = true and $worksaturday=false and $fullweeks=0 ,32,0);
var Number startsatremovehours = If ($worksaturday=true and $startonweekend=true, ($weekendhours-$saturdayhoursonstart),0);
var Number endsatremovehours = If($worksaturday=true and $endonweekend=true, ($weekendhours-$hoursonend),0);
var Number removenonworkedweekendhours = If($startorendonweekend=true, ($fullweeks-1)*$weekendhours,$fullweeks*$weekendhours);
If($sameday=true,$completeduration,
If($worksaturday=false, $alldaystotalhours - ($fullweeks*$unworkedweekendhours) - (($fulldaysofwork-$weekenddays)*$nonworkhours)-$workdayhoursnotworked - $removeshortweekhours
,$alldaystotalhours- $startsatremovehours - $endsatremovehours -$workdayhoursnotworkedsat -(($fulldaysofwork-$weekenddays)*$nonworkhours)-$removenonworkedweekendhours-$workdayhoursnotworked
))
I said it was ugly but there are notes throughout the entire formula