Average with multiple criteia in same column

jdurand02

New Member
Joined
Jan 7, 2013
Messages
4
I need to find the average of a value based on multiple values in multiple columns.

=AVERAGE(IF(Data!D:D="Smith", If(Data!G:G="N/A", If(Data!G:G="TP", If(Data!H:H="Standard", If(Data!H:H="Consulting", If(Data!H:H="Multi_Consulting", If(Data!H:H="Standard_MP", If(Data!H:H="Multi_MP", If(Data!H:H="Multi", If(Data!K:K="8",Data!T:T)))))))))))

Basically if column D = Smith and
Column K = 8 and
Column G = N/A OR TP and
Column H = Standard OR Consulting OR Multi_Consulting OR Standard_MP OR Multi_MP OR Multi

Columns G and H can have a variety of combinations (so basically the values in Column H will have either a N/A or TP in column G).

Please let me know if this does not make sense. I have tried quite a few variations inclusing SumProduct and AverageIfs and nothing seems to work for what I need.

Thanks. :oops:
 

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.
Don't have EXcel at the mo', but try
Code:
=AVERAGE(IF(AND(Data!D:D="Smith", Data!K:K="8",Data!G:G="N/A"), IF(OR(Data!G:G="TP", Data!H:H="Standard", Data!H:H="Consulting", Data!H:H="Multi_Consulting",Data!H:H="Standard_MP", Data!H:H="Multi_MP",Data!H:H="Multi"),Data!T:T)))
 
Upvote 0
Welcome to the board. Is this what you're after?
=AVERAGE(IF(Data!D:D="Smith",IF(OR(Data!G:G={"N/A","TP"}),IF(OR(Data!H:H={"Standard","Consulting","Multi_Consulting","Standard_MP","Multi_MP","Multi"}),IF(Data!K:K="8",Data!T:T)))))

Note that referring to an entire column is inadvisable - if the size of your data is variable, consider dynamic ranges.
 
Upvote 0
Hi and welcome to the forum,

Also untested, but for Excel 2007+ maybe:

Code:
=SUM(SUMIFS(
       Data!T:T,
         Data!D:D,"Smith",
         Data!G:G,{"N/A","TP"},
         Data!H:H,{"Standard","Consulting","Multi_Consulting","Standard_MP","Multi_MP","Multi"},
         Data!K:K,"8"))/
SUM(COUNTIFS(
         Data!D:D,"Smith",
         Data!G:G,{"N/A","TP"},
         Data!H:H,{"Standard","Consulting","Multi_Consulting","Standard_MP","Multi_MP","Multi"},
         Data!K:K,"8"))
 
Upvote 0
Thank you, but that did not work. I even made my ranges dynamic but it only returns a 0. I have checked and everything is pointing where it needs to. I am pretty fluent in Excel and advanced formulas, I just cannot figure out why this one is giving me such a hard time.
 
Upvote 0
Still no luck making the formulas an array. I am trying to figure out how to attach a sample document, but not having much luck.
 
Upvote 0
I need to find the average of a value based on multiple values in multiple columns.

=AVERAGE(IF(Data!D:D="Smith", If(Data!G:G="N/A", If(Data!G:G="TP", If(Data!H:H="Standard", If(Data!H:H="Consulting", If(Data!H:H="Multi_Consulting", If(Data!H:H="Standard_MP", If(Data!H:H="Multi_MP", If(Data!H:H="Multi", If(Data!K:K="8",Data!T:T)))))))))))

Basically if column D = Smith and
Column K = 8 and
Column G = N/A OR TP and
Column H = Standard OR Consulting OR Multi_Consulting OR Standard_MP OR Multi_MP OR Multi

Columns G and H can have a variety of combinations (so basically the values in Column H will have either a N/A or TP in column G).

Please let me know if this does not make sense. I have tried quite a few variations inclusing SumProduct and AverageIfs and nothing seems to work for what I need.

Thanks. :oops:

Control+shift+enter, not just enter:
Rich (BB code):
=AVERAGE(
  IF(Data!$D$2:$D$400="Smith",
  IF(ISNUMBER(MATCH(Data!$G$2:$G$400,{"N/A","TP"},0)), 
  IF(ISNUMBER(MATCH(Data!$H$2:$H$400,
       {"Standard","Consulting","Multi_Consulting",
        "Standard_MP","Multi_MP","Multi"},0)),
  IF(Data!$K$2:$K$400=8,
    Data!$T$2:$T$400)))))

If the range in column K is really text, modify 8 as "8". See also Post #4 for a 2007 system or later.
 
Upvote 0
If the range in column K is really text, modify 8 as "8". See also Post #4 for a 2007 system or later.

barry houdini has very kindly pointed out why post #4 won't work, so I thought I would share it here:

I replied to the thread above but my answer was almost identical to Aladin's so I deleted -

Re your version - that's a viable option but in order for all combinations for columns G and H to be considered you need to separate one of these two

{"Standard","Consulting","Multi_Consulting","Standard_MP","Multi_MP","Multi"}

{"N/A","TP"}

....with commas and one with semi-colons in each of the SUMIFS/COUNTIFS functions (thus giving a 2x6 matrix of results which is then summed)

Note that Aladin's version is more easily "extensible" - if you have 3 or more multi-condition criteria then the SUMIFS/COUNTIFS option can't work

regards, barry

Here is the corrected version but as barry has stated, Aladin's version is more flexible:

Code:
=SUM(SUMIFS(
       Data!T:T,
         Data!D:D,"Smith",
         Data!G:G,{"N/A";"TP"},
         Data!H:H,{"Standard","Consulting","Multi_Consulting","Standard_MP","Multi_MP","Multi"},
         Data!K:K,8))/
SUM(COUNTIFS(
         Data!D:D,"Smith",
         Data!G:G,{"N/A";"TP"},
         Data!H:H,{"Standard","Consulting","Multi_Consulting","Standard_MP","Multi_MP","Multi"},
         Data!K:K,8))
 
Upvote 0

Forum statistics

Threads
1,215,903
Messages
6,127,652
Members
449,395
Latest member
Perdi

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