AVERAGEIFS() problem with partial text

StefanoM

New Member
Joined
Jul 20, 2016
Messages
7
Dear All,
I'm new to the forum and this is my first thread!
I have the below spreadsheet that I want to be dynamic in choosing data to make the correct average.
In the coloumns from C to K there are the data.
In the coloumns from M to Q there are the formulas I'm trying to sort out.
I want to average the values in the table based on the letter I put in green
For example the formula in M10 is =(AVERAGEIFS($C10:$K10;$C$4:$K$4;$M$4)) and the result is 85, the avarage of all the "A" letters in the table for the corresponding row.
Of course the formula looks for the exact match of the cell choosen, but it doesn't work if I put a combination of the cells I want to average.
In fact the columns N and O don't work and I wasn't able to use wildcards to make it function properly.
I want to put "AB" in the cell N4 and have, for example in cell N10, 183 as a result of the average of all the A and B letters in the table.
Thank you for your help!

B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
3
Mean Recovery (%)
Mean Recovery (%)
Mean Recovery (%)
Mean Recovery (%)
Mean Recovery (%)
4
Level
A
A
A
B
B
B
C
C
C
A
AB
ABC
B
C
5
Replicate
1
2
3
1
2
3
1
2
3





6
Condition














7
Lim Min














8
Lim Max














9
Analyte
10
Li7
85
87
82
284
288
273
423
435
409
85
#DIV/0!
#DIV/0!
282
422
11
Ba135
224
218
236
773
734
750
1088
1112
1116
226
#DIV/0!
#DIV/0!
752
1105

<tbody>
</tbody>



Stefano
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Try this array formula entered with CTRL + SHIFT + ENTER

=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,M$4));$C10:$K10))
 
Last edited:
Upvote 0
It does work for Column M but not for the N where I put "AB"
Which response are you referring to, they are each slightly different.

And note, they are both ARRAY formulas that require special key stroke to enter correctly.
After typing the formula, DO NOT PRESS ENTER.
Instead, Press CTRL + SHIFT + ENTER
When done correctly, you will see the formula enclosed with {brackets}
 
Upvote 0
Yes, the formula is correct with the brackets.
I'm referring to the response in the cell N10 that should be the average of the numbers 85, 87, 82, 284, 288, 273 (=183)
 
Upvote 0
I'm referring to the response in the cell N10 that should be the average of the numbers 85, 87, 82, 284, 288, 273 (=183)
I meant, were you referring to the formula I posted, or the one Aladin Posted ?

Anyway, it works fine for me.

Unknown
ABCDEFGHIJKLMNOPQ
33Mean Recovery (%)Mean Recovery (%)Mean Recovery (%)Mean Recovery (%)Mean Recovery (%)
44LevelAAABBBCCCAABABCBC
55Replicate123123123
66Condition
77Lim Min
88Lim Max
99Analyte
1010Li785878228428827342343540985183263282422
1111Ba1352242182367737347501088111211162264896957521105
Sheet2
Cell Formulas
RangeFormula
M10{=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,M$4)),$C10:$K10))}
M11{=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,M$4)),$C11:$K11))}
N10{=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,N$4)),$C10:$K10))}
N11{=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,N$4)),$C11:$K11))}
O10{=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,O$4)),$C10:$K10))}
O11{=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,O$4)),$C11:$K11))}
P10{=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,P$4)),$C10:$K10))}
P11{=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,P$4)),$C11:$K11))}
Q10{=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,Q$4)),$C10:$K10))}
Q11{=AVERAGE(IF(ISNUMBER(SEARCH($C$4:$K$4,Q$4)),$C11:$K11))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Ok, I got it working, I was exchanging the order of the function search because you and Aladin posted quite the same formula and the correct one is yours.
I was wondering, if in your opinion, there is another way to do it without an array function?
Thank you a lot!
 
Upvote 0
Sure, try

=SUMPRODUCT(--(ISNUMBER(SEARCH($C$4:$K$4,M$4))),$C10:$K10)/SUMPRODUCT(--(ISNUMBER(SEARCH($C$4:$K$4,M$4))))

However, I wouldn't call this 'Better'. If anything it's likely much less efficient.
And it's technically still an array formula, it just doesn't require CTRL + SHIFT + ENTER.
 
Last edited:
Upvote 0
Ok, I got it working, I was exchanging the order of the function search because you and Aladin posted quite the same formula and the correct one is yours.
I was wondering, if in your opinion, there is another way to do it without an array function?
Thank you a lot!

I had the search arguments switched. By the way, you need array processing with or without control+shift+enter.
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,830
Members
449,471
Latest member
lachbee

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