Combining multiple array formulas

Garrix

New Member
Joined
Aug 13, 2014
Messages
28
I have several formulas used to calculate the average of a bunch of data points. Currently, I have to have a sub-section on a spare worksheet that then pulls those results back into the main sheet. I'm hoping that there is a way to bypass this, I know alot of people on this forum are hellaciously good at fixing things (as my more recent thread found..).

Current formula:
Code:
 =AVERAGE(IF(ISNUMBER(SEARCH("*PIEA*",PIESHEET!$E:$E)),IF(ISNUMBER(PIESHEET!$L:$L),PIESHEET!$L:$L,""),">0")
=AVERAGE(IF(ISNUMBER(SEARCH("*PIEB*",PIESHEET!$E:$E)),IF(ISNUMBER(PIESHEET!$L:$L),PIESHEET!$L:$L,""),">0")
=AVERAGE(IF(ISNUMBER(SEARCH("*PIEC*",PIESHEET!$E:$E)),IF(ISNUMBER(PIESHEET!$L:$L),PIESHEET!$L:$L,""),">0")

All resulting values then get put into a basic =average(result:cells).

Is there any way I can do the above in a single formula?
 
Control+shift+enter, not just enter:
Rich (BB code):
=AVERAGE(IF(ISNUMBER(SEARCH({"PIEA","PIEB","PIEC"},$A$1:$A$12)),
  IF(ISNUMBER($B$1:$B$12),$B$1:$B$12)))

Or with the search strings in E1:G1...
Rich (BB code):
=AVERAGE(IF(ISNUMBER(SEARCH(E1:G1,$A$1:$A$12)),
  IF(ISNUMBER($B$1:$B$12),$B$1:$B$12)))

Is is simpler to somehow make it an 'if number is >0' instead of just an 'is cell number' flag? I feel like I have a major mistake somewhere, since I'm getting almost 30m differences in my averages (between your formula and my crappy way).
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
What are we going to discuss post #10 or #11? I was going to respond to #10...

I think I quoted the wrong post. Whoops!

Back to the formula:

Code:
=IFERROR(AVERAGE(IF(ISNUMBER(AVERAGEIF(Data!$E:$E,"*"&{"PIET";"PIEY";"PIEE"}&"*",DATA!$L:$L)),
  AVERAGEIF(DATA!$E:$E,"*"&{"PIET";"PIEY";"PIEE"}&"*",DATA!$L:$L))), "NA")

provides a different result than just using

Code:
=IFERROR(AVERAGE(IF(ISNUMBER(SEARCH("*PIET*",DATA!$E:$E)),IF(ISNUMBER(DATA!$L:$L),DATA!$L:$L,""),">0")),"NA")

for each one and then averaging the column. Any ideas?
 
Last edited:
Upvote 0
I think I quoted the wrong post. Whoops!

Back to the formula:

Code:
=IFERROR(AVERAGE(IF(ISNUMBER(AVERAGEIF(Data!$E:$E,"*"&{"PIET";"PIEY";"PIEE"}&"*",DATA!$L:$L)),
  AVERAGEIF(DATA!$E:$E,"*"&{"PIET";"PIEY";"PIEE"}&"*",DATA!$L:$L))), "NA")

provides a different result than just using

Code:
=IFERROR(AVERAGE(IF(ISNUMBER(SEARCH("*PIET*",DATA!$E:$E)),IF(ISNUMBER(DATA!$L:$L),DATA!$L:$L,""),">0")),"NA")

for each one and then averaging the column. Any ideas?

1. Please avoid referencing whole columns for reasons of efficiency.

2. The second formula (yours) has a ">0" in there. Not clear what does that mean.

3. The first formula operates on three criteria, while the second considers just one.
 
Upvote 0
1. Please avoid referencing whole columns for reasons of efficiency.

2. The second formula (yours) has a ">0" in there. Not clear what does that mean.

3. The first formula operates on three criteria, while the second considers just one.

1. Okay. Best to pick a range and update it if it will change?

2. That's a legacy formula that I am using from the old spreadsheet. I thought that the >0 was a 'only if greater than 0' criteria?

3. Nono, I mean If

Code:
=IFERROR(AVERAGE(IF(ISNUMBER(SEARCH("*PIET*",DATA!$E:$E)),IF(ISNUMBER(DATA!$L:$L),DATA!$L:$L,""),">0")),"NA")
=IFERROR(AVERAGE(IF(ISNUMBER(SEARCH("*PIEY*",DATA!$E:$E)),IF(ISNUMBER(DATA!$L:$L),DATA!$L:$L,""),">0")),"NA")
=IFERROR(AVERAGE(IF(ISNUMBER(SEARCH("*PIEE*",DATA!$E:$E)),IF(ISNUMBER(DATA!$L:$L),DATA!$L:$L,""),">0")),"NA")

and do a =average(aboveresults)

I get a different result. Unless I was just unclear on my earlier question?
 
Upvote 0
1. Okay. Best to pick a range and update it if it will change?

2. That's a legacy formula that I am using from the old spreadsheet. I thought that the >0 was a 'only if greater than 0' criteria?

3. Nono, I mean If

Code:
=IFERROR(AVERAGE(IF(ISNUMBER(SEARCH("*PIET*",DATA!$E:$E)),IF(ISNUMBER(DATA!$L:$L),DATA!$L:$L,""),">0")),"NA")
=IFERROR(AVERAGE(IF(ISNUMBER(SEARCH("*PIEY*",DATA!$E:$E)),IF(ISNUMBER(DATA!$L:$L),DATA!$L:$L,""),">0")),"NA")
=IFERROR(AVERAGE(IF(ISNUMBER(SEARCH("*PIEE*",DATA!$E:$E)),IF(ISNUMBER(DATA!$L:$L),DATA!$L:$L,""),">0")),"NA")

and do a =average(aboveresults)

I get a different result. Unless I was just unclear on my earlier question?

Try to create a tiny sample where the formulas do differ?
 
Upvote 0
Try to create a tiny sample where the formulas do differ?


Thanks for sticking with this. I found out again that I was asking the wrong question

Rich (BB code):
=AVERAGE(IF(ISNUMBER(SEARCH({"PIEA","PIEB","PIEC"},$A$1:$A$12)),   IF(ISNUMBER($B$1:$B$12),$B$1:$B$12)))
Rich (BB code):
Rich (BB code):
Or with the search strings in E1:G1...
Code:


=AVERAGE(IF(ISNUMBER(SEARCH(E1:G1,$A$1:$A$12)),   IF(ISNUMBER($B$1:$B$12),$B$1:$B$12)))</pre>

I need the above, not the average of averages. The first one works fine, but the second one gives a DIV/0 error. Any ideas? From what I can see, they are almost the same. It doesn't seem to like me using A3:A10 instead of explicitly naming them it seem.
 
Upvote 0
Thanks for sticking with this. I found out again that I was asking the wrong question

Rich (BB code):
=AVERAGE(IF(ISNUMBER(SEARCH({"PIEA","PIEB","PIEC"},$A$1:$A$12)),   IF(ISNUMBER($B$1:$B$12),$B$1:$B$12)))
Rich (BB code):
Or with the search strings in E1:G1...
Code:


=AVERAGE(IF(ISNUMBER(SEARCH(E1:G1,$A$1:$A$12)),   IF(ISNUMBER($B$1:$B$12),$B$1:$B$12)))
</PRE>

I need the above, not the average of averages. The first one works fine, but the second one gives a DIV/0 error. Any ideas? From what I can see, they are almost the same. It doesn't seem to like me using A3:A10 instead of explicitly naming them it seem.

That shouldn't happen. See the workbook that shows this observation:
https://dl.dropboxusercontent.com/u/65698317/Garrix%20If%20Conditioned%20Average.xlsx
 
Upvote 0

Forum statistics

Threads
1,225,053
Messages
6,182,582
Members
453,126
Latest member
NigelExcel

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