问题
I would like to develop a formula to construct a table of the top 5 titles / values within multiple groups, preferably without VBA. I have attached an example. Since I am new to this forum and require need at least 10 reputation points to post images, I have uploaded a screenshot to: http://i.imgur.com/v1LAkYk.png * Thanks @Scott Craner for adding the image to the post!
I have already discovered and reviewed the following thread: Extracting top 5 maximum values (based on group) in excel. Using the formula I was able to pull out the top 5 from the entire list as a whole, but I have not been able to incorporate an IF clause to separate the rankings by group.
Thanks in advance for your time and consideration! Please let me know if my request is unclear and/or if you have any specific questions. Appreciate any support!
回答1:
Try this:
=Large(If(C:C = "Group 1",A:A),Row(1:1))
This would go into the top right cell of Group 1 results(F3?). It is an array formula and must be confirmed with Ctrl-Shift-Enter.
For the Items In E3:
If the values are unique; No ties:
=INDEX(B:B,MATCH(F3,IF(C:C = "GROUP 1",A:A),0))
If there is possibility of a tie then it gets a little more complicated.
=INDEX(B:B,MATCH(1,IF(C:C = "GROUP 1",IF(A:A = F3,IF(COUNTIF(B:B,$E$2:$E2) = 0,1,0),0),0),0))
Both are array formulas and must be confirmed with Ctrl-Shift-Enter. then copied down.
Note: These array formulas will iterate through the entire column, which will take time. It would be advantageous to limit the full column ranges to the actual absolute data range. For example change C:C to $C$3:$C$1000, if 1000 was the last row.
For more information on Array Formulas, See THIS
来源:https://stackoverflow.com/questions/34909354/extract-top-5-values-for-each-group-in-a-list-without-vba