Averageif with Date range help

hofst038

New Member
Joined
Mar 11, 2016
Messages
17
Hey guys, got a tough one that I need help with:
Date
Devices Installed
Lead Time on Site (Hours)
Non Lead Time on Site(Hours)
3/11/2016
2
2.00
3.00
3/15/2016
5
4.00
6.00
3/17/2016
1
1.00
4/1/2016
2
1.25
0.75

<tbody>
</tbody>

<tbody>
</tbody>

I am trying to find the average between the lead time on site (column C) and the non lead time on site (Column D) as it pertains to a date range. For the date range of 3/11-3/18 I need the average time it took the techs to complete the install. In some cases there was not a second technician so it would be just the average time of the lead tech on that date
- The answer/average for the date range of 3/11-3/18 I am looking for is 3.2

My formula (below) is spitting out a different number and I cant get it right. Any suggestions are helpful!

=AVERAGEIFS($C$2:$C$5,$A$2:$5,">="&”3/11/2016”,$A$2:$A$5,"<="&”3/18/2016”)+AVERAGEIFS($D$2:$D$5,$A$2:$A$5,">="&”3/11/2016”,$A$2:$A$5,"<="&”3/18/2016”)/AVG(IF(AND(ISNUMBER(C3),ISNUMBER(D3)),AVERAGE(C3:D3/2),AVERAGE(C3:D3)))
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Not sure I follow how you're wanting to do the actual Math.

How did you come to 3.2 as your desired result ? Which numbers exactly is 3.2 the average OF, and Why ?
 
Upvote 0
I probably did not do a great job of making sense. 5 total technicians within the date range of 3/11/2016-3/18/2016. Total hours for the technicians in the date range of 3/11/2016-3/18/2016 = 16. Total hours/technicians (16/5=3.2).
 
Upvote 0
OK, I get it.

Now, can we assume the dates are sorted in AScending order?
And are the 2 technician columns contiguous, like Column D and Column E ?
 
Upvote 0
Disregard those questions, I was thinking there might be an easier way.

This seems to work

=SUMPRODUCT(($A$2:$A$5>=$H$2)*($A$2:$A$5<=$I$2)*$C$2:$D$5)/SUMPRODUCT(($A$2:$A$5>=$H$2)*($A$2:$A$5<=$I$2)*($C$2:$D$5<>""))

I put the start and end dates in H2 and I2
 
Last edited:
Upvote 0
Nailed it, thanks! Taking it a step further....I now want to divide the average install time by number of devices on that corresponds to that date, would my formula look like this:

=SUMPRODUCT(($A$2:$A$5>=$H$2)*($A$2:$A$5<=$I$2)*$C$2:$D$5)/SUMPRODUCT(($A$2:$A$5>=$H$2)*($A$2:$A$5<=$I$2)*($C$2:$D$5<>""))/SUMPRODUCT(($A$2:$A$5>=$H$2)*($A$2:$A$5<=$I$2)*$B$2:$B$5)
 
Upvote 0
I think you need to add parens around the the first average..

=(SUMPRODUCT(($A$2:$A$5>=$H$2)*($A$2:$A$5<=$I$2)*$C$2:$D$5)/SUMPRODUCT(($A$2:$A$5>=$H$2)*($A$2:$A$5<=$I$2)*($C$2:$D$5<>"")))/SUMPRODUCT(($A$2:$A$5>=$H$2)*($A$2:$A$5<=$I$2)*$B$2:$B$5)
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

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