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:
[TABLE="width: 284"]
<tbody>[TR]
[TD][TABLE="width: 284"]
<tbody>[TR]
[TD]Date
[/TD]
[TD]Devices Installed
[/TD]
[TD]Lead Time on Site (Hours)
[/TD]
[TD]Non Lead Time on Site(Hours)
[/TD]
[/TR]
[TR]
[TD]3/11/2016
[/TD]
[TD] 2
[/TD]
[TD]2.00
[/TD]
[TD]3.00
[/TD]
[/TR]
[TR]
[TD]3/15/2016
[/TD]
[TD] 5
[/TD]
[TD]4.00
[/TD]
[TD]6.00
[/TD]
[/TR]
[TR]
[TD]3/17/2016
[/TD]
[TD] 1
[/TD]
[TD] 1.00
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4/1/2016
[/TD]
[TD] 2
[/TD]
[TD] 1.25
[/TD]
[TD] 0.75[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
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,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

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