Reputation: 25
Okay, this question is pretty complicated and may not be possible.
I have Zip codes in Column A (on average the same zip code is repeated 5 times in column A, with 2600 unique zip codes), I then have a number representing students in Column B (in some cases this number is sometimes 0), Then in Column C I have the unique Zip Codes Listed out.
I am trying to match Column A & C together and get an Average of Column B placed in Column D.
I tried: =INDEX(B:B,MATCH(C2,A:A,0))
found in another answer, but this only get's me the first number that shows up in Column B and not the Average for those zip codes.
I have attached an Image of what it would look like (with me manually doing the math)
Upvotes: 2
Views: 307
Reputation: 5482
Try this:
=AverageIf(A:A,C2,B:B)
This is a great formula that does basically exactly what you are trying to do.
The formula was designed to do exactly what you are trying to do. It performs Sumif/Countif. This will scan Col A for all rows that match your cell C2. Then it takes the average of all Col B values for those matched rows.
You could drag the formula down for all unique Zip Codes in column C.
Upvotes: 1