Reputation: 1
I have an Excel spreadsheet of outage records with start and end times. I have another spreadsheet that shows how many customers typically use the system during any specific hour of a specific weekday and a cost per customer that gets routed to customer care instead of being handled by self-service. I want to use a complex formula, preferably (rather than VBA, if possible), that can look at the outage time, determine how many minutes in each hour are "outage minutes", how many customers would be impacted during that many minutes of that hour and return a final cost.
For example:
Hourly Customer Volume Table
Hour Customers
0 50
1 150
2 500
Outage record
Outage start: 0:35 (h24:mm)
Outage end: 2:42 (h24:mm)
Correct answer the forumula(s) should deliver the final total value below:
Sum of (((25/60)*50)+((60/60)*150)+((42/60)*500)) = 520.83 customer impacts.
So far my best idea is to use a whole mess of formulas:
I have reasonable fluency with building formulas in Excel but I certainly am not familiar with all of the options. I've recently had good success with things like sumif/sumifs and I've built more nested if formulas than I can count.
How can I accomplish this "weighted impact cost" calculation with any reasonable level of efficiency?
Upvotes: 0
Views: 69
Reputation: 152660
make sure the times are true times without a date part and use:
=SUMPRODUCT(LOOKUP(HOUR(ROW(INDEX(XFD:XFD,(B7*24*60)):INDEX(XFD:XFD,B8*24*60-1))/(24*60)),A2:A4,B2:B4)/60)
If the times include a date then use:
=SUMPRODUCT(LOOKUP(HOUR(ROW(INDEX(XFD:XFD,MOD(B7,1)*24*60):INDEX(XFD:XFD,(B8-TIME(0,1,0)-B7+MOD(B7,1))*24*60))/(24*60)),A2:A4,B2:B4)/60)
Upvotes: 1