averaging text occurences based on two criteria

CaveGirl

New Member
Joined
Mar 10, 2011
Messages
2
I need to average the number of "Yes" occurances in P9:P500 based on whether B9:B500 = "SA". I am totally stumped. It seems like it should be easy but for some reason I can't get my head around it today and I'm getting really frustrated!!!! Any help would be greatly appreciated. Thanks!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Not sure how you average text strings. You can count when both conditions are true:
=SUMPRODUCT(--(B9:B500="SA"),--(P9:P500="Yes"))
 
Upvote 0
Welcome to the board.

You neglect to state which version of Excel you are using. The following formula would work for Excel 2007 or 2010. Take a look at the COUNTIFS and COUNTIF functions. Also, the form in which you stated your problem is a bit tough to interpret. I am interpreting it to mean "# of Yeses for SA / # of SA's". Applied to your problem, I believe your solution would be:

=COUNTIFS(P9:P500,"Yes",B9:B500,"SA")/COUNTIF(B9:B500,"SA")

Let us know if you would need a version for 2003 or lower.
 
Last edited:
Upvote 0
Thanks to both of you, I am using 2007 so the first solution works perfectly, I just need to modify it to divide by the total number of entries in the P column and I have my average!

Thanks so much for the quick response, I'm so glad I found this board :)
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,713
Members
452,939
Latest member
WCrawford

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