Averageif help

Kkajr

New Member
Joined
Feb 3, 2018
Messages
10
Hi, so im trying to do an averageif based on if the range contains a certain word, here is how I tried it

=AVERAGEIF(D2:D892, "*"&LEFT(D2:D892,(FIND(",",D2:D892,1)-1))&"*", B2:B892)

But the word it picks is the word on the same row in column D, so if i move the cell up to 5 for example, it would pick the word from d5, move it down to 10, d10.

Any help appreciated, ill have a lot more questions in the coming hours
 
Guessing from the bits and your non-working formula...

Control+shift+enter, not just enter:

=AVERAGE(IF(ISNUMBER(SEARCH("|"&X2&",","|"&$D$2:&D&892&",")),IF($G$2:$G$892,$B$2:$B$892)))

where X2 is a name of interest like Andersson.
<strike></strike><strike></strike>
 
Last edited:
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Yeah, so im still working that out, but its the name of interest that is what im stuck on. I want to find out each name at each row separately. Maybe a loop might work, id have to figure that out. And thank you for your patience, I know this might be getting old. Is there a way to (in the criteria) search for any word from every line, but not any word from all lines? Like, at d2 or something I want to look in every row for abbing, and at d5 every row for abelson... etc. But not abbing for all rows, because then thats the only output I get. If that still isnt clear, i'm thinking of a better way to state that.
 
Upvote 0
Okay, Im gonna write a quick loop to see if that helps.

for(int i; i <= 892; i++) {

=AVERAGEIFS(B2:B892, D2:D892, "*"&LEFT(Di,(FIND(",",Di,1)-1))&"*", G2:G892, "=1")
//where Di is the column D at given row i
}

and I want to average all those outputs.
 
Upvote 0
I dont really understand it, i see it takes the average if it looks up name of interest and it finds it, itll return true, taking us to the second if statement which looks like 2 bounds to me, i understand the second bound is the bound the average is gonna use, but the first one doesnt look like a condition.
 
Upvote 0
I dont really understand it, i see it takes the average if it looks up name of interest and it finds it, itll return true, taking us to the second if statement which looks like 2 bounds to me, i understand the second bound is the bound the average is gonna use, but the first one doesnt look like a condition.

Did it work for you?

If not, try to post a scaled-down sample (not an image) along with the expected results for that sample?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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