How can split an outage time duration into different segments / ranges

edwardj3

New Member
Joined
Jan 16, 2018
Messages
41
Office Version
  1. 365
Platform
  1. Windows
I am monitoring service outages using excel 2007. I have a start and and end time as shown in the example below. Start and end time are in dd/mm/yyyy hh:mm:ss format.

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Start[/TD]
[TD]End[/TD]
[TD]Days[/TD]
[TD]Hours[/TD]
[/TR]
[TR]
[TD]03/01/2018 18:30:00[/TD]
[TD]04/01/2018 02:42:00[/TD]
[TD]0.342[/TD]
[TD]8.20[/TD]
[/TR]
</tbody>[/TABLE]

Days is worked out using the following formula =IF(H31>G31,H31-G31, 1-G31+H31)
Hours worked out using the following formula =M31*24

Whilst the above provides the total outage duration is it possible to split the outage duration into segments / time ranges using a formula/formulas or some code? So for the example above the result would be as below. The formula/ code must take into account that an outage could span different days.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Hours Impacted Range[/TD]
[TD]Total Hours[/TD]
[/TR]
[TR]
[TD]06:00 - 11:59[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]12:00 - 14:59[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]15:00 - 17:59[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]18:00 - 22:59[/TD]
[TD]4.5[/TD]
[/TR]
[TR]
[TD]23:00 - 05:59[/TD]
[TD]3.7
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
See if this works for you:


Excel 2010
ABCD
1StartEndDaysHours
21/3/2018 18:301/4/2018 2:420.3428.2
3
4
5Hours Impacted StartHours Impacted EndTotal Hours
61/3/2018 6:001/3/2018 12:000
71/3/2018 12:001/3/2018 15:000
81/3/2018 15:001/3/2018 18:000
91/3/2018 18:001/3/2018 23:004.5
101/3/2018 23:001/4/2018 5:593.7
11
Sheet1
Cell Formulas
RangeFormula
C2=IF(B2>A2,B2-A2, 1-A2+B2)
C6=MAX(0,MIN(B6,$B$2)-MAX($A$2,A6))/($B$2-$A $2)*$D$2
C7=MAX(0,MIN(B7,$B$2)-MAX($A$2,A7))/($B$2-$A$2)*$D$2
C8=MAX(0,MIN(B8,$B$2)-MAX($A$2,A8))/($B$2-$A$2)*$D$2
C9=MAX(0,MIN(B9,$B$2)-MAX($A$2,A9))/($B$2-$A$2)*$D$2
C10=MAX(0,M IN(B10,$B$2)-MAX($A$2,A10))/($B$2-$A$2)*$D$2
D2=C2*24
 
Upvote 0
Your solution works perfectly VBA Geek. Thanks for responding so quickly. If you get an opportunity could you provide an explanation so I fully understand what the formula is actually doing. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,224,808
Messages
6,181,072
Members
453,020
Latest member
mattg2448

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