![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Posts: 107
|
I have an Excel 97 database in which I track 'games scores' for pitchers. That is a calculated field, and there can be duplicate scores. I want to produce a dynamic list of the top-10 game scores and the associated pitcher, so when I add new records, the list updates.
There is no problem with the games scores themselves. In cells C2:C11 I have the numbers 1 through 10, then copy this formula in cells D2:D11 =LARGE(M$22:M$300,C2) =LARGE(M$22:M$300,C3) etc. I have been using the following formulas in cells E2:E11 to match the pitcher's name to the corresponding game score, but it does not work when there are duplicate games scores; it uses the first pitcher it finds for any given score. =INDEX($D:$D,MATCH(LARGE(D:D,C2),M:M,0)) =INDEX($D:$D,MATCH(LARGE(D:D,C3),M:M,0)) etc. The result look like this: Rank GameScore Pitcher 1 92 D_Lowe 2 86 P_Martinez 3 84 P_Martinez 4 82 F_Castillo 5 79 P_Martinez 6 77 D_Lowe 7 75 D_Oliver 8 75 D_Oliver 9 73 D_Lowe 10 71 J_Burkett However, for the two game scores of 75, one record should be Pitcher=P_Martinez and the other should be D_Oliver. Can anyone help me sort this out? Thanks, Cliff |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,318
|
The result look like this:
Rank GameScore Pitcher 1 92 D_Lowe 2 86 P_Martinez 3 84 P_Martinez 4 82 F_Castillo 5 79 P_Martinez 6 77 D_Lowe 7 75 D_Oliver 8 75 D_Oliver 9 73 D_Lowe 10 71 J_Burkett Cliff, Care to post the data from which the above result list is constructed? Aladin [ This Message was edited by: Aladin Akyurek on 2002-05-20 07:12 ] |
|
|
|
|
|
#3 | |
|
Board Regular
Join Date: Apr 2002
Posts: 107
|
Quote:
I thought that you could just take it from the result I lisdted, but here is some actual data with a duplicate game score with different pitchers. G BOSTON...... ip. h r er bb so hr era. GS 1 P_Martinez.. 3.0 9 8 7 2 4 0 9.00 13 2 D_Lowe...... 7.0 1 0 0 3 1 0 0.00 73 3 F_Castillo.. 6.0 1 1 1 1 3 1 1.50 68 4 P_Martinez., 6.0 3 1 0 1 5 0 0.00 68 5 T_Wakefield. 5.0 5 4 4 0 4 1 7.20 45 6 D_Lowe...... 7.0 8 2 2 1 3 0 2.57 55 7 F_Castillo.. 6.0 3 2 2 3 4 1 3.00 59 8 D_Oliver.... 5.2 5 0 0 3 4 0 0.00 60 If you just list the top five, then the output should be 73 D_Lowe 68 F_Castillo 68 P_Martines 60 D_Oliver 59 F_Castillo Thanks, Cliff |
|
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,318
|
Cliff,
To save space I omit the columns between pitchers and scores. Lets assume that these are in columns A and B. In C2 enter and copy down: =RANK(B2,$B$2:$B$9)+COUNTIF($B$2:B2,B2)-1 In E2 enter and copy down: =INDEX(A:A,MATCH(ROW()-1,$C$2:$C$9,0)+1) The last formula can also be entered in a diffrent worksheet than the one that houses the data. The figure below shows these formulas in action: To see the formula in the cells just click on the cells hyperlink The above image was automatically generated by [HtmlMaker V1.26] If you want FREE SOFT, click here and Colo will email the file to you This code was graciously allowed to be modified: by Ivan F Moala All credit to Colo Aladin ADDENDUM. The formula in E2: =INDEX(A:A,MATCH(ROW()-1,$C$2:$C$9,0)+1) can be also expressed as: =INDEX(A:A,MATCH(ROW(1:1),$C$2:$C$9,0)+1) The change is in order to avoid difficulties some users have in adjusting the -1 bit. [ This Message was edited by: Aladin Akyurek on 2002-08-07 17:14 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|