Time Difference (Working Minutes)

duttom

New Member
Joined
Jun 14, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello,

I was wondering if anybody could help, please.

I have a spreadsheet where I am trying the work out the time difference between when a job came in and when it was resolved - but I want the output to only count hours and minutes during the business's operating hours.

I have been able to work out the total time difference, as below (Sheet 1).

1655201324835.png


But working out the working metrics is what I'm struggling with.

1655201237329.png


I only want the hours / minutes to be counted if they fall within the working hours which are specified on Sheet 2.

1655201394148.png


Thanks in advance for any help.
 

Attachments

  • 1655201188594.png
    1655201188594.png
    26.6 KB · Views: 4

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
The formulas are based on

How to Calculate Net Work Hours Between Two Dates - Excel Tactics

Please check thoroughly before use.

The net working hours/minutes are on Cols H & I.

I’d added a dummy row 22 to test the holidays exclusion.

Net Work Hours Example.xlsx
ABCDEFGHI
1HolidaysStart TimeEnd Time
203/01/2022Mon-Fri09:0020:00
315/04/2022Sat09:0018:00
418/04/2022Sun09:0017:00
502/05/2022
602/06/2022
703/06/2022
829/08/2022
926/12/2022
1027/12/2022
11Start DateEnd DateNet Work Hours (Mon-Fri)Net Work Hours (Sat)Net Work Hours (Sun)Net Work HoursNet Work Mins
1209/05/2022 06:5009/05/2022 13:594.980.000.004.98299
1331/05/2022 15:1031/05/2022 17:262.270.000.002.27136
1411/05/2022 19:3212/05/2022 10:021.500.000.001.5090
1503/05/2022 17:3403/05/2022 18:320.970.000.000.9758
1625/05/2022 23:3626/05/2022 10:241.400.000.001.4084
1705/05/2022 10:4805/05/2022 11:320.730.000.000.7344
1806/06/2022 13:0607/06/2022 15:0312.950.000.0012.95777
1928/05/2022 10:0228/05/2022 12:210.002.320.002.32139
2029/05/2022 16:5830/05/2022 09:080.130.000.030.1710
2111/05/2022 11:3212/05/2022 09:248.870.000.008.87532
2201/06/2022 13:0607/06/2022 15:0323.959.008.0040.952457
Net Work Hours
Cell Formulas
RangeFormula
E12:E22E12=IF(OR($F$2<$E$2,D12<C12),0,(NETWORKDAYS(C12,D12,HolidayList)-(NETWORKDAYS(C12,C12,HolidayList)*IF(MOD(C12,1)>$F$2,1,(MAX($E$2,MOD(C12,1))-$E$2)/($F$2-$E$2)))-(NETWORKDAYS(D12,D12,HolidayList)*IF(MOD(D12,1)<$E$2,1,($F$2-MIN($F$2,MOD(D12,1)))/($F$2-$E$2))))*($F$2-$E$2)*24)
F12:F22F12=(NETWORKDAYS.INTL(C12,D12,"1111101",HolidayList)-(NETWORKDAYS.INTL(C12,C12,"1111101",HolidayList)*IF(MOD(C12,1)>$F$3,1,(MAX($E$3,MOD(C12,1))-$E$3)/($F$3-$E$3)))-(NETWORKDAYS.INTL(D12,D12,"1111101",HolidayList)*IF(MOD(D12,1)<$E$3,1,($F$3-MIN($F$3,MOD(D12,1)))/($F$3-$E$3))))*($F$3-$E$3)*24
G12:G22G12=(NETWORKDAYS.INTL(C12,D12,"1111110",HolidayList)-(NETWORKDAYS.INTL(C12,C12,"1111110",HolidayList)*IF(MOD(C12,1)>$F$4,1,(MAX($E$4,MOD(C12,1))-$E$4)/($F$4-$E$4)))-(NETWORKDAYS.INTL(D12,D12,"1111110",HolidayList)*IF(MOD(D12,1)<$E$4,1,($F$4-MIN($F$4,MOD(D12,1)))/($F$4-$E$4))))*($F$4-$E$4)*24
H12:H22H12=SUM(E12:G12)
I12:I22I12=SUM(E12:G12)*60
Named Ranges
NameRefers ToCells
HolidayList='Net Work Hours'!$A$2:$A$10E12:G22
 
Upvote 0
Solution
The formulas are based on

How to Calculate Net Work Hours Between Two Dates - Excel Tactics

Please check thoroughly before use.

The net working hours/minutes are on Cols H & I.

I’d added a dummy row 22 to test the holidays exclusion.

Net Work Hours Example.xlsx
ABCDEFGHI
1HolidaysStart TimeEnd Time
203/01/2022Mon-Fri09:0020:00
315/04/2022Sat09:0018:00
418/04/2022Sun09:0017:00
502/05/2022
602/06/2022
703/06/2022
829/08/2022
926/12/2022
1027/12/2022
11Start DateEnd DateNet Work Hours (Mon-Fri)Net Work Hours (Sat)Net Work Hours (Sun)Net Work HoursNet Work Mins
1209/05/2022 06:5009/05/2022 13:594.980.000.004.98299
1331/05/2022 15:1031/05/2022 17:262.270.000.002.27136
1411/05/2022 19:3212/05/2022 10:021.500.000.001.5090
1503/05/2022 17:3403/05/2022 18:320.970.000.000.9758
1625/05/2022 23:3626/05/2022 10:241.400.000.001.4084
1705/05/2022 10:4805/05/2022 11:320.730.000.000.7344
1806/06/2022 13:0607/06/2022 15:0312.950.000.0012.95777
1928/05/2022 10:0228/05/2022 12:210.002.320.002.32139
2029/05/2022 16:5830/05/2022 09:080.130.000.030.1710
2111/05/2022 11:3212/05/2022 09:248.870.000.008.87532
2201/06/2022 13:0607/06/2022 15:0323.959.008.0040.952457
Net Work Hours
Cell Formulas
RangeFormula
E12:E22E12=IF(OR($F$2<$E$2,D12<C12),0,(NETWORKDAYS(C12,D12,HolidayList)-(NETWORKDAYS(C12,C12,HolidayList)*IF(MOD(C12,1)>$F$2,1,(MAX($E$2,MOD(C12,1))-$E$2)/($F$2-$E$2)))-(NETWORKDAYS(D12,D12,HolidayList)*IF(MOD(D12,1)<$E$2,1,($F$2-MIN($F$2,MOD(D12,1)))/($F$2-$E$2))))*($F$2-$E$2)*24)
F12:F22F12=(NETWORKDAYS.INTL(C12,D12,"1111101",HolidayList)-(NETWORKDAYS.INTL(C12,C12,"1111101",HolidayList)*IF(MOD(C12,1)>$F$3,1,(MAX($E$3,MOD(C12,1))-$E$3)/($F$3-$E$3)))-(NETWORKDAYS.INTL(D12,D12,"1111101",HolidayList)*IF(MOD(D12,1)<$E$3,1,($F$3-MIN($F$3,MOD(D12,1)))/($F$3-$E$3))))*($F$3-$E$3)*24
G12:G22G12=(NETWORKDAYS.INTL(C12,D12,"1111110",HolidayList)-(NETWORKDAYS.INTL(C12,C12,"1111110",HolidayList)*IF(MOD(C12,1)>$F$4,1,(MAX($E$4,MOD(C12,1))-$E$4)/($F$4-$E$4)))-(NETWORKDAYS.INTL(D12,D12,"1111110",HolidayList)*IF(MOD(D12,1)<$E$4,1,($F$4-MIN($F$4,MOD(D12,1)))/($F$4-$E$4))))*($F$4-$E$4)*24
H12:H22H12=SUM(E12:G12)
I12:I22I12=SUM(E12:G12)*60
Named Ranges
NameRefers ToCells
HolidayList='Net Work Hours'!$A$2:$A$10E12:G22

Thank you very much, AlanY! This has been really helpful.
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,457
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top