Averageifs Question

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
767
Office Version
  1. 365
Platform
  1. Windows
Good afternoon,

I am trying to use the"averageifs" function to average a column based on the description and date.

I have been able to use the "averageifs" to match "1 description" and a date criteria (B6-1 yesterdays date) Formula 1, but I need to do this to include up to 3 descriptions that fall under 1 group.

I have tried the following as an array "Formula 2" which works but I am unsure how I can add the date specifications in.
I have tried doing 2 averageifs adding them together and dividing by 2 but this doesn't work

Code:
Formula 1
=AVERAGEIFS(Call_Data!Q:Q,Call_Data!F:F,"Description",Call_Data!C:C,Calcs!$B$6-1)
[code/]
[code]
Formula 2
=AVERAGE(IF(ISNUMBER(MATCH(Call_Data!F:F, {"Description 1","Description 2"},0)),Call_Data!Q:Q))
[code/]

thanks in advance
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You need to do SUM/COUNT, the average functions don't work with 'OR' criteria types.

For example

=SUM(SUMIFS(Call_Data!Q:Q,Call_Data!F:F,{"Description 1","Description 2"}))/SUM(COUNTIFS(Call_Data!F:F,{"Description 1","Description 2"}))
 
Upvote 0
What version of Excel are you using? I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version.
 
Upvote 0
I have updated my profile.

@jasonb75 how would I put the date restrictions into the formula as I will be doing a couple of ranges as well as the previous day

thanks
 
Upvote 0
Then if you have the FILTER function, try a structure like this. I would avoid whole column references if possible.

20 04 01.xlsm
FQRS
1
2Description 113.33333
3Description 32
4Description 33
5Description 24
6Description 15
7Description 36
8
Average
Cell Formulas
RangeFormula
S2S2=AVERAGE(FILTER(Q2:Q7,(F2:F7="Description 1")+(F2:F7="Description 2")))
 
Upvote 0
This should do it

=SUM(SUMIFS(Call_Data!Q:Q,Call_Data!F:F,Call_Data!C:C,Calcs!$B$6-1,{"Description 1","Description 2"}))/SUM(COUNTIFS(Call_Data!C:C,Calcs!$B$6-1,Call_Data!F:F,{"Description 1","Description 2"}))
 
Upvote 0
how would I put the date restrictions into the formula
Like this for me. The formula is averaging the two coloured cells.

BTW, thanks for updating your profile. (y)

20 04 01.xlsm
BCDEFGPQRS
1
231/03/2020Description 112.5
328/03/2020Description 32
428/03/2020Description 33
531/03/2020Description 24
601-Apr-2028/03/2020Description 15
728/03/2020Description 36
Average
Cell Formulas
RangeFormula
S2S2=AVERAGE(FILTER(Q2:Q7,((F2:F7="Description 1")+(F2:F7="Description 2"))*(C2:C7=B6-1)))
B6B6=TODAY()
 
Upvote 0
thank you both,
I will try both of these and see which works best for the current issue
 
Upvote 0
I would say that Peter's suggestion would be the better of the 2, but remember that it only works with office 365, if you have to send the workbook to another user on an older version of excel then they will see #NAME? instead of the results. The method that I suggested will work with any versions back to 2007.
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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