Averageifs based on month criteria

kreineke

New Member
Joined
Sep 4, 2014
Messages
7
OK,

I have been fighting a simple problem.


I want to average a range in column A if the cell contains a number(some cells are blank or show error), and the date in the adjacent cell is equal to a specified month.

Thanks for any help,

Kirk
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
These array formulas will work.

If the dates fall within the same year you can use:
{=AVERAGE(IF(ISNUMBER(A1:A100),IF(MONTH(A1:A100)=MONTH(D4),B1:B100)))}

If they don't, you may want to include a year reference if you don't want your average to include last year's data for the same month.
{=AVERAGE(IF(ISNUMBER(A1:A100),IF((YEAR(A1:A100)=YEAR(D4))*(MONTH(A1:A100)=MONTH(D4)),B1:B100)))}

Where D4 contains a reference date.
Use Ctrl+Shift+Enter to get the brackets
 
Upvote 0
Please explain why to evaluate Month(a1:a100); that is the range that I am averaging. The dates are contained in the adjacent column B1:B100. I have tried this formula and it returns DIV#0
 
Upvote 0
It looks like I just mixed up your columns, which would explain a #DIV/0! error. Just swap those references.
 
Upvote 0

Forum statistics

Threads
1,213,549
Messages
6,114,264
Members
448,558
Latest member
aivin

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