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.

StartEndDaysHours
03/01/2018 18:30:0004/01/2018 02:42:000.3428.20

<tbody>
</tbody>

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.

Hours Impacted RangeTotal Hours
06:00 - 11:590
12:00 - 14:590
15:00 - 17:590
18:00 - 22:594.5
23:00 - 05:593.7

<tbody>
</tbody>
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
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,214,819
Messages
6,121,729
Members
449,049
Latest member
MiguekHeka

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