averageifs of value if 2 time range overlap

fitzxlr8s

New Member
Joined
Nov 23, 2014
Messages
4
I'm at a loss. I've searched high and low for a solution.

A2:A5 size unit
B2:B5 time range beginning
C2:C5 time range end

$d$2 : Date1
$d$3 : Date2

I'm trying to find the average size of units that were active during D2:D3

I can identify if time ranges intersect with:

=if(or( c2:c5 <d2,d3<b2:b5), "overlap", "no overlap")<d2.d3<b2:b5), "overlap",="" "no="" overlap")<d2,d3<b2:b5),="" no="" overlap")


But I don't know how to use this to find the average of the units.

=if(or(and(b2:b5>=d2, b2:b5<=d3),and(d2>=b2:b5,d2<=c2:c5),average(a2:a5),0)

I know this is wrong. Any help would be appreciated</d2.d3<b2:b5),>
 
Last edited:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
for some reason my first formula isn't showing up in my post.

=if(or(and(C2:c5>=D2,D3< B2:B5), "overlap", "no overlap")
 
Last edited by a moderator:
Upvote 0
Welcome to the MrExcel board!

If you have a formula with a "<" symbol followed by a letter, the forum software thinks it it is HTML code and the result is what happened to you. If that happens, just edit your post and put a space between those two characters, as I have done for you in your second post.

Now, in relation to your question, could we see some sample data and expected result(s) with an explanation related directly to that sample?
 
Upvote 0
Thank you Peter. Here's a quick sample:

abc de
Sizecontract_startcontract_EndIntervalsAvg_Size_ Active
14001/1/20144/1/20141/1/2014625.00
25002/1/20145/2/20144/1/2014740.00
34003/1/20148/1/20147/1/20141033.33
412004/1/20147/1/201410/1/20141500.00
515005/1/201411/1/20141/1/2015
61006/1/20146/2/20144/1/2015

<colgroup><col><col><col><col><col span="2"><col><col></colgroup><tbody>
</tbody>

<colgroup><col><col><col><col span="2"><col><col></colgroup><tbody></tbody>


I'm try to find out which units were active during the intervals set in d (d2:d3, d3:d4, etc) and then average out the size of those units in e.
 
Upvote 0
Could you ..
a) confirm whether your dates are d/mm/yy or m/dd/yy?
b) explain how you manually calculated those results?

a) my dates are mm/dd/yy
b) Here's how I manually calculated the "E" column

E1: units A1, A2, A3, A4 all have time ranges that overlap D1:D2

400 + 500 +400 +1200 = 2500
2500 / 4 units = 625

E2: units A1, A2, A3, A4, A5, A6 all overlap D2:D3
4100 / 6 units = 683 (mistake in my original data. can Correct in edit, sorry)

E3: Units A3, A4, A5 overlap D3:D4
3100 / 3 units = 1033

E4: Units A5 is the only unit to overlap D4:D5
1500 / 1 unit = 1500

E5: Not units overlap D5:D6
 
Upvote 0
Try this. To avoid the error values you might want to wrap the formula in an IFERROR() function.

Excel Workbook
ABCDE
1Sizecontract_startcontract_EndIntervalsAvg_Size_ Active
24001/01/141/04/141/01/14625
35001/02/142/05/141/04/14683.3333333
44001/03/141/08/141/07/141033.333333
512001/04/141/07/141/10/141500
615001/05/141/11/141/01/15#DIV/0!
71001/06/142/06/141/04/15#DIV/0!
Average
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,834
Members
449,471
Latest member
lachbee

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