2
I have data by month from January 2013 -> October 2017 as such
MONTH MY DATA
Jan-13 45.0
Feb-13 23.0
.
.
.
Oct-17 98.4
I wish to average data by calendar month, for specific, non-contiguous date ranges. E.G. January 2013 - > March 2013 and October 2016 -> May 2017.
I believe this can be accomplished by using IF functions with OR, to encompass multiple date ranges, and AND, to encompass two dates within each range, to return an array (when entering as an array formula) then using averageif on the returned array.
With my data in B5:C62 and my bespoke date ranges set up as:
Period 1 Start: S2
Period 1 End: T2
Period 2 Start: S3
Period 2 End: T3
And my calendar months in P6:P17, I enter my formula as
=AVERAGEIF($B$5:$B$62,P6,IF(OR(AND($B$5:$B$62>=$S$2,$B$5:$B$62<=$T$2),
AND($B$5:$B$62<=$S$3,$B$5:$B$62>=$T$3)),$C$5:$C$62,"ERROR"))
I get a #VALUE! error, though I can't see why. As far as I can tell my IF clause should be returning the "average_range" for the AVERAGEIF formula to run on.
What is the error in my formula or my approach?