AverageIfs with dates

anwaee2

Board Regular
Joined
Sep 13, 2012
Messages
151
Office Version
  1. 2011
Platform
  1. MacOS
I am running Excel For Mac 2010. I am having trouble getting monthly averages for specific months
of the year. I know the data columns are good as I am able to extract a lot of other information from them.
I would appreciate any help I can get with this. I am wondering if it is an Excel for Mac problem and not the formula.
Thanks in advance.

Dates is the named range for dates 1/1/2020 to 12/31/2020 (Data!A6:A371)
Named range Lo_2020 is in cell R2. (Data!C6:C371) (lowest temperature of each day)
Feb is in cell R3.

=AVERAGEIFS(R2,Dates,">="&R3,Dates,"<="&EOMONTH(R3,0))
Gives me #VALUE!

=AVERAGEIFS(Lo_2020,Dates,">="&Feb,Dates,"<="&EOMONTH(Feb,0))
Gives me #VALUE!

=AVERAGEIFS(Data!C6:C371,Data!A6:A371,">="&Feb,Data!A6:A371,"<="&EOMONTH(Feb,0))
Gives me #DIV/0!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try this:
Excel Formula:
=AVERAGEIFS(INDIRECT(R2),Dates,">="&DATE(YEAR(INDEX(Dates,1)),MONTH(DATEVALUE(R3&"1")),1),Dates,"<="&EOMONTH(DATE(YEAR(INDEX(Dates,1)),MONTH(DATEVALUE(R3&"1")),1),0))
 
Upvote 0
To shorten it a bit, you could put a helper formula in S3, the "DATE(YEAR..." portion, then replace that with S3 in the formula.

S3:
Excel Formula:
=DATE(YEAR(INDEX(Dates,1)),MONTH(DATEVALUE(R3&"1")),1)

New formula:
Excel Formula:
=AVERAGEIFS(INDIRECT(R2),Dates,">="&S3,Dates,"<="&EOMONTH(S3,0))
 
Upvote 0
Try this:
Excel Formula:
=AVERAGEIFS(INDIRECT(R2),Dates,">="&DATE(YEAR(INDEX(Dates,1)),MONTH(DATEVALUE(R3&"1")),1),Dates,"<="&EOMONTH(DATE(YEAR(INDEX(Dates,1)),MONTH(DATEVALUE(R3&"1")),1),0))
Thank you so much, that works great.
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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