MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 20th, 2002, 07:22 AM   #1
baseball
Board Regular
 
Join Date: Apr 2002
Posts: 107
Default

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
baseball is offline   Reply With Quote
Old May 20th, 2002, 08:11 AM   #2
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,318
Default

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 ]
Aladin Akyurek is offline   Reply With Quote
Old May 20th, 2002, 05:02 PM   #3
baseball
Board Regular
 
Join Date: Apr 2002
Posts: 107
Default

Quote:
On 2002-05-20 07:11, Aladin Akyurek wrote:
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 ]
Aladin,

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



baseball is offline   Reply With Quote
Old May 20th, 2002, 10:35 PM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,318
Default

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:

Microsoft Excel - aaTopPitchers Baseball.xls___Running: xl2000 : OS = Windows (32-bit) NT 5.00
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp
A1=G BOSTON

A
B
C
D
E
1
G BOSTONGSRank

2
P_Martinez13:alert('=RANK(B2,$B$2:$B$9)+COUNTIF($B$2:B2,B2)-1')>8
:alert('=INDEX(A:A,MATCH(ROW()-1,$C$2:$C$9,0)+1)')>D_Lowe
3
D_Lowe73:alert('=RANK(B3,$B$2:$B$9)+COUNTIF($B$2:B3,B3)-1')>1
:alert('=INDEX(A:A,MATCH(ROW()-1,$C$2:$C$9,0)+1)')>F_Castillo
4
F_Castillo68:alert('=RANK(B4,$B$2:$B$9)+COUNTIF($B$2:B4,B4)-1')>2
:alert('=INDEX(A:A,MATCH(ROW()-1,$C$2:$C$9,0)+1)')>P_Martinez
5
P_Martinez68:alert('=RANK(B5,$B$2:$B$9)+COUNTIF($B$2:B5,B5)-1')>3
:alert('=INDEX(A:A,MATCH(ROW()-1,$C$2:$C$9,0)+1)')>D_Oliver
6
T_Wakefield45:alert('=RANK(B6,$B$2:$B$9)+COUNTIF($B$2:B6,B6)-1')>7
:alert('=INDEX(A:A,MATCH(ROW()-1,$C$2:$C$9,0)+1)')>F_Castillo
7
D_Lowe55:alert('=RANK(B7,$B$2:$B$9)+COUNTIF($B$2:B7,B7)-1')>6

8
F_Castillo59:alert('=RANK(B8,$B$2:$B$9)+COUNTIF($B$2:B8,B8)-1')>5

9
D_Oliver60:alert('=RANK(B9,$B$2:$B$9)+COUNTIF($B$2:B9,B9)-1')>4

Sheet1

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 ]
Aladin Akyurek is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:11 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes