Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Average a range of values if the date associated with it falls within a date range

I'm trying to average a range of values if its associated date falls between two specified dates. The following function works:

AVERAGEIFS($1:$1,$2:$2,">=1/1/2014",$2:$2,"<=1/2/2014")

...in this case the values that you want to average are in row 1 and the dates that are associated with it are in row 2.

However, in this case I'm explicitly stating the date range in my formula (">=1/1/2014" and "<=1/2/2014"). Is there any way to create a similar formula that allows me to reference date cells to determine my date range instead of having to explicitly state the dates in the formula itself???

like image 731
Ryan Chase Avatar asked Apr 28 '15 22:04

Ryan Chase


People also ask

How do you average date ranges in Excel?

Formula Break down Here, IF((B5:B15>=B5)*(B5:B15<=B13),D5:D15) formula will yield the result as {100;200;300;400;500;600;700;800;900;FALSE;FALSE}, where it took all the sale values within our specified range. Then AVERAGE({100;200;300;400;500;600;700;800;900;FALSE;FALSE}) will give us the output 500.

Can you use Vlookup with date range?

The VLOOKUP function matches the largest date that is smaller or equal to the lookup date. If the lookup date is 3-31-2009 it will match 3-31-2009 found in cell B4 and return the corresponding value in column C (cell C4). In this case nothing, cell C4 is empty. This applies to all date ranges in column B.

What is average range in Averageif?

The AVERAGEIFS function is a premade function in Excel, which calculates the average of a range based on one or more true or false condition.


2 Answers

you can use the following, by putting the start date and the end date in another cell and refer to them in your formula:

=AVERAGEIFS($1:$1,$2:$2,">="&$B$4,$2:$2,"<="&$B$5)

with the following example:
enter image description here

like image 155
Marcel Avatar answered Sep 23 '22 03:09

Marcel


Assuming your two dates are in E5 and F5 you could do it like this:

=AVERAGEIFS($1:$1,$2:$2,">="&E5,$2:$2,"<="&F5)
like image 39
Dave Sexton Avatar answered Sep 20 '22 03:09

Dave Sexton