How to quickly change criteria with AVERAGEIF

RhatT

New Member
Joined
Jan 27, 2016
Messages
4
Hello. This is my first time posting so I am hoping that my explanation is clear enough. I have two columns (see below). I want the average number of column B for each month so have used the following formula:
=AVERAGEIF(A2:A2604, "*01/1966", F2:F2604)
This works but my problem is that my data set goes from 1966 to 2015 so changing this formula for every month and year would take hours and hours. Does anyone have any suggestions of a faster way of doing this?
The date for each of column a is a 'week commencing' so I cannot just do an average and drag because each month has a different number of dates.

Thank you in advance

A B
05/02/1966 60.981
12/02/1966 60.981
19/02/1966 165.844
26/02/1966 165.844
05/03/1966 165.844
12/03/1966 165.844
19/03/1966 110.514
26/03/1966 110.514
02/04/1966 110.514
09/04/1966 110.514
16/04/1966 135.907
23/04/1966 135.907
30/04/1966 111.671
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
I suggest you use a Pivot Table, which took me 30 seconds to assemble for your data. Do you know how to use PTs? If not, we can help you get started.
 
Upvote 0
I do not know how to use pivot tables and would greatly appreciate your help. Thank you very much
 
Upvote 0
I'm not at a desktop right now, but I'll get to this tomorrow. In the meantime, you could watch this video on youtube to familiarise yourself with the powerful PT functionality.
https://youtu.be/e-yuYNgsHAk
 
Upvote 0
As the video above demonstrated, create a proper data set. For your data, place Date in column A and Quantity in column B. Ensure that the field Dates are actually all Excel Date Serial Number dates and not text. From that data create a PivotTable; I recommend doing so on a new sheet because you have a lot of data. In the PTFileds area drag field Date into the ROWS section. Right click in the PT in any cell and select group; fields Months and Years alone should be selected. In the PTFileds area drag field Quantity into the VALUES section. Alter the value field setting for SUM or AVERAGE or whatever you want to calculate. Conduct any cosmetic cleanup. Voila.
 
Last edited:
Upvote 0
Thank you ever so much DRSteele. I wasn't aware of this functionality but I Have been able to get the exact results I needed. Thanks again!
 
Upvote 0

Forum statistics

Threads
1,215,586
Messages
6,125,687
Members
449,249
Latest member
ExcelMA

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