SOLVED

Counting of business and non business hours white a ticket was open

Copper Contributor
Kindly your help
I need your help in developing a formula to count the business and non business hours for a group of tickets.. I have data about entering and releasing time.. And i want to split the used time acoarding to a special time like from sun to Thu the business hours from( 8:00-16:00) and from(16:00 - 00:00) while from 00:00-8:00 should be count as non business hours.. But on fri and saturday the whole working hours are count as non business hours..
Thank you
9 Replies

Hi @Najat_abu_hamad,

 

You want to count business and non-business hours.

I have developed a formula according to the conditions you require, please check in the attached sheet and let me know to have detailed description, if it solves your problem.  

Hi@Vimal_Gaur 

Thank you for your effort...

the point that most of the tickets were open between two dates,i.e:severaldays and different time schedule,

here is the required task showing below and the attached file have the data you may need to understand the process:

calculate the number of business and non-business hours accoarding to the table on the attached screenshoot (plz,make it configurable, not hardcoded as the time scheduling table may change, whereby the sum of business and non business hours should equal the difference between columns  Q-P 

 

 

best response confirmed by Najat_abu_hamad (Copper Contributor)
Solution

@Najat_abu_hamad 

If add helper columns like this

image.png

not to harcode constants, the formula could be

=24*(
   IF(
      INT(Q2)-INT(P2)>2,
      NETWORKDAYS.INTL(P2+1,Q2-1,7),0
   ) +
   IF(
      INT(Q2)=INT(P2),
      MIN(MOD(Q2,1),$AF$2)-MAX(MOD(P2,1),$AE$2),
      ($AF$2-MAX(MOD(P2,1),$AE$2))*(WEEKDAY(P2,15)>2) +
      MAX(MOD(Q2,1)-$AE$2,0)*(WEEKDAY(Q2,15)>2)
   )
)

result in hours (e.g. 1.5 hour, not 01:30)

Hi@Sergei Baklan 

Thanks a lot for your help,it is effective formula for the most of data but the problem now is when i tried to drag and drop the formula to the rest of data, in some cells it gives me #name! or #num! excel error as shown on the attached file, and on some cells like cell(Z3), the formula results ( in business hours> duration ), and that is not correct and therefore gives negative # of non business hours.. 

to solve the negativity problem i observed that this issue only happened when non business hours=0,so i can filter these cells and choose business hours = duration directly.

Thanks for your attention. I'm looking forward to your reply

 

@Najat_abu_hamad 

Something strange, I opened the file you attached to the latest post and see no one #NAME! or #NUM! error. Calculations are also correct (at least Business Hours are less than Duration)

image.png

All negative results are -0.01 as at the bottom right of above screenshort. That's rounding error, you may entire formula for Non-Busiess hours as

=IF(<formula> <0, 0, <formula>)

I recalculate the sheet, please check attached again.

@Sergei Baklan 

The formula works perfect.

Thanks a lot for your time and effort.

Hi @Sergei Baklan 

If I want to exclude the official holidays from the business and non-business hours calculations, how I can exclude them without affecting the formula, I already defined the holidays at column AG as shown in the attached file.

what about if I added the optional parameter "Holidays" referes to dates that should be considered as non-work days"Holidays" in the NETWORKDAYS.INTL excel function , is it enough or should i do or edit more?

 

what about if I added the optional parameter "Holidays" referes to dates that should be considered as non-work days"Holidays" in the NETWORKDAYS.INTL excel function , is it enough or should i do or edit more?

1 best response

Accepted Solutions
best response confirmed by Najat_abu_hamad (Copper Contributor)
Solution

@Najat_abu_hamad 

If add helper columns like this

image.png

not to harcode constants, the formula could be

=24*(
   IF(
      INT(Q2)-INT(P2)>2,
      NETWORKDAYS.INTL(P2+1,Q2-1,7),0
   ) +
   IF(
      INT(Q2)=INT(P2),
      MIN(MOD(Q2,1),$AF$2)-MAX(MOD(P2,1),$AE$2),
      ($AF$2-MAX(MOD(P2,1),$AE$2))*(WEEKDAY(P2,15)>2) +
      MAX(MOD(Q2,1)-$AE$2,0)*(WEEKDAY(Q2,15)>2)
   )
)

result in hours (e.g. 1.5 hour, not 01:30)

View solution in original post