Hours functions

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,059
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have this functions and its not giving the required result, is there a other way to fix it. any other function will be great.

note:- excel version is 2016 and higher, so functions need to be working in all versions

Excel Formula:
=IF(A2="RRC",((NETWORKDAYS.INTL(B2,C2,16,0)-1)*("23:00"-"08:00")+MEDIAN(MOD(C2,1),"23:00","08:00")-MEDIAN(MOD(B2,1),"23:00","08:00"))*24,IF(A2="DC",((NETWORKDAYS.INTL(B2,C2,16,0)-1)*("23:00"-"09:00")+MEDIAN(MOD(C2,1),"23:00","09:00")-MEDIAN(MOD(B2,1),"23:00","09:00"))*24,IF(A2="Quality",((NETWORKDAYS.INTL(B2,C2,16,0)-1)*("22:00"-"10:00")+MEDIAN(MOD(C2,1),"22:00","10:00")-MEDIAN(MOD(B2,1),"22:00","10:00"))*24,(C2-B2)*24)))


Book2
ABCDE
1TASK TYPECreate DateUpdate DateTask Duration Business HoursActual
2RRC10/21/2023 20:2010/21/2023 21:491.5
3Filtration10/21/2023 19:5710/21/2023 21:491.9
4RRC10/14/2023 15:1710/15/2023 11:0610.8
5Filtration10/14/2023 15:0710/15/2023 11:0620.0
6Filtration10/20/2023 14:2410/20/2023 14:240.0
7Filtration10/25/2023 0:2110/25/2023 0:210.0
8Filtration10/16/2023 13:1810/16/2023 13:180.0
9RRC10/20/2023 10:0610/20/2023 12:28-12.6this cannot be -ve it should be 2.2(hrs)
10DC10/19/2023 19:4110/20/2023 18:43-1.0this cannot be -ve it should be
11DC10/13/2023 4:1810/13/2023 16:43-6.3this cannot be -ve it should be 12.2(hrs)
12DC10/13/2023 15:1810/13/2023 21:10-8.1this cannot be -ve
13RRC10/13/2023 14:2210/13/2023 21:10-8.2this cannot be -ve
Sheet1
Cell Formulas
RangeFormula
D2:D13D2=IF(A2="RRC",((NETWORKDAYS.INTL(B2,C2,16,0)-1)*("23:00"-"08:00")+MEDIAN(MOD(C2,1),"23:00","08:00")-MEDIAN(MOD(B2,1),"23:00","08:00"))*24,IF(A2="DC",((NETWORKDAYS.INTL(B2,C2,16,0)-1)*("23:00"-"09:00")+MEDIAN(MOD(C2,1),"23:00","09:00")-MEDIAN(MOD(B2,1),"23:00","09:00"))*24,IF(A2="Quality",((NETWORKDAYS.INTL(B2,C2,16,0)-1)*("22:00"-"10:00")+MEDIAN(MOD(C2,1),"22:00","10:00")-MEDIAN(MOD(B2,1),"22:00","10:00"))*24,(C2-B2)*24)))
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I think the issue has to do with the fact that October 20 is a Friday and you've told NETWORKDAYS that is a weekend.
 
Upvote 0
I think the issue has to do with the fact that October 20 is a Friday and you've told NETWORKDAYS that is a weekend.
ok, but if we exclude week end, cna this be fixed, as i tried many ways, also the end user will be using lower version 2016.

please suggest.
 
Upvote 0
I don;t have time today. Rather than having us dissect the formula, could you state the business rules for how duration must be calculated?
 
Upvote 0

Forum statistics

Threads
1,215,102
Messages
6,123,097
Members
449,096
Latest member
provoking

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