1st place, 2nd place winner

erutherford

Active Member
Joined
Dec 19, 2016
Messages
453
I have a sheet titled "scores". Columns are name (text), division (text) and Score (number). I would like create another sheet (Awards) that displays the 1st and 2nd place winners (highest scores) in each division from the "scores" sheet.

example: Name Division Score
Bob Full 299
Joe Street 298
Bill Full 297
Ted Street 296

Thanks in advance and I'll keep searching the forum.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Perhaps:


ABCDEFGHIJKLMNO
NameDivisionScoreDivisionFirstSecond
BobFullFullAlBobXavierBill
JoeStreetStreetJoeTed
BillFullAvenueMarkMaryAliceJake
TedStreet
AlFullDivisionFirstSecondThird
MarkAvenueFullAlBobXavierBill
JakeAvenueStreetJoeTed
MaryAvenueAvenueMarkMaryAliceJake
AliceAvenue
XavierFull

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]Third[/TD]
[TD="align: right"]Fourth[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]299[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]298[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]297[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]296[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]300[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]Fourth[/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]261[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]300[/TD]

[TD="align: right"]299[/TD]

[TD="align: right"]299[/TD]

[TD="align: right"]297[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]251[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]298[/TD]

[TD="align: right"]296[/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]260[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]261[/TD]

[TD="align: right"]260[/TD]

[TD="align: right"]260[/TD]

[TD="align: right"]251[/TD]

[TD="align: center"]10[/TD]

[TD="align: right"]260[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]11[/TD]

[TD="align: right"]299[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]12[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Scores

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]G2[/TH]
[TD="align: left"]{=IFERROR(INDEX(Scores!$A$2:$A$20,SMALL(IF(COUNTIF($F2:F2,Scores!$A$2:$A$20)=0,IF(Scores!$B$2:$B$20=$F2,IF(Scores!$C$2:$C$20=MAX(IF(COUNTIF($F2:F2,Scores!$A$2:$A$20)=0,IF(Scores!$B$2:$B$20=$F2,Scores!$C$2:$C$20))),ROW(Scores!$A$2:$A$20)-ROW(Scores!$A$2)+1))),1)),"")}[/TD]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]G7[/TH]
[TD="align: left"]{=IFERROR(LARGE(IF(Scores!$B$2:$B$20=$F7,Scores!$C$2:$C$20),COLUMNS($F7:G7)/2),"")}[/TD]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]H7[/TH]
[TD="align: left"]{=IFERROR(INDEX(<fo
Scores!$A$2:$A$20,SMALL(IF(Scores!$B$2:$B$20=$F7,IF(Scores!$C$2:$C$20=G7,ROW(Scores!$A$2:$A$20)-ROW(Scores!$A$2)+1)),COUNTIF($G7:G7,G7))</fo
),"")}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]


If you just want the names, use the G2 formula. Copy down and across as desired. If you want names and scores, use the G7:H7 formulas. Put them in and copy them as a pair, and paste them down and across as desired.

You can also use a Pivot Table. Select A1:G11, Insert Pivot Table, put Division - Score - Name into the Rows box (in that order), right click on the score in A5, select Sort Largest to Smallest. Somewhat awkward display though. There's probably a better way.
 
Upvote 0
Thanks Eric for your help. I been dissecting it so I can understand what is happening. I made a test worksheet and made two separate tables. One for sample G2 and one for the others. Pasted the statements in and the results are all zero. I thought we could upload a sample file, but I guess not.

When you say "paste as a pair", what separates the two statements?

I am trying to get the easiest one working first (just the name), then move to the move complex one.

thanks again for your help
 
Upvote 0
Hmm. These are tricky formulas, so it might take a bit to understand them and get them working. A few tips: these are array formulas. This means that they work on a range of data, and you have to enter them using Control+Shift+Enter, or they won't work. So set up your sample sheet, select the cell where you want the formula, paste the formula in the formula bar, then hold down the Control and Shift keys, then press Enter. If you don't do that, the formula won't work right, and you might get the zero results.

Next, if you're trying to dissect them, you might be better off starting with the 2 formula set. The single formula is basically a combination of the 2 smaller formulas. When I say, "copy pairwise", in the example above, put the G7 formula in and confirm with CSE. Put the H7 formula in and confirm with CSE. Then select both cells (G7:H7), copy them (Control-C, or right click and select Copy), then select the range you want to put them (I7:N7), and paste them (Control-V or right click and select Paste). Then select G8:N9 and paste again.

To adapt the formulas for your sheet, you'll obviously need to change the ranges in the formulas. If you have trouble doing so, set up your sheets just like my example, and when it's working, just add/delete rows/columns until it matches what you want, Excel will adapt the formulas for you.

Finally, you can't upload a sheet to the forum, but you can use a tool such as the HTML Maker (see my signature) to show a sample like I did. You can also upload a file to a file sharing service (like Dropbox) and post a link, but many people will not download files from the internet, limiting the number of people who might help you.

Let me know if you have further questions.
 
Upvote 0
Eric,
First, thanks for taking the time to "spell it out" for me. That is what made it possible for me (a novice) to understand what was going on, apply it to my situation and it now works. Huge help!
Thanks again!
 
Upvote 0
Glad you got it working! :cool:

I've learned a lot here and elsewhere, and I'm happy to pass some of it along. Thanks for the feedback.
 
Upvote 0
Eric can you have two sets of criteria in the logic array?
Code:
=IFERROR([COLOR=Blue]LARGE([COLOR=Red]IF([COLOR=Green]Scores!$B$2:$B$20=$F7[/COLOR][/COLOR][/COLOR]
. So $F7 is one criteria, can you have more than one in the same array?

People enter their car in Full concours, then the car is further divided into subcategories of A,B or C.
Example: Category = Full (F7)
Sub category = A model (?)

thanks again
 
Upvote 0
Before answering your question, I want to offer a suggestion: name your ranges, then you don't have to include the worksheet names in the cell references. It will clear out the functions significantly.

Okay, if I understand your question correctly, you want to test on two criteria to select a value for a particular place (e.g., list the person that came in 2nd in the Full-A division (assuming A is the subdivision). In the example below I have named the ranges of values Name, Division, Subdivision, Score:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Name[/TD]
[TD]Division[/TD]
[TD]Subdivision[/TD]
[TD]Score[/TD]
[TD][/TD]
[TD][/TD]
[TD]Division:[/TD]
[TD]Avenue[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Bob[/TD]
[TD]Full[/TD]
[TD]A[/TD]
[TD]299[/TD]
[TD][/TD]
[TD][/TD]
[TD]Subdivision:[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Joe[/TD]
[TD]Street[/TD]
[TD]B[/TD]
[TD]298[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Bill[/TD]
[TD]Full[/TD]
[TD]B[/TD]
[TD]297[/TD]
[TD][/TD]
[TD][/TD]
[TD]1st:[/TD]
[TD]Mark[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Ted[/TD]
[TD]Street[/TD]
[TD]A[/TD]
[TD]296[/TD]
[TD][/TD]
[TD][/TD]
[TD]2nd:[/TD]
[TD]Alice[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Al[/TD]
[TD]Full[/TD]
[TD]A[/TD]
[TD]300[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Mark[/TD]
[TD]Avenue[/TD]
[TD]C[/TD]
[TD]261[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Jake[/TD]
[TD]Avenue[/TD]
[TD]B[/TD]
[TD]251[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Mary[/TD]
[TD]Avenue[/TD]
[TD]A[/TD]
[TD]260[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]Alice[/TD]
[TD]Avenue[/TD]
[TD]C[/TD]
[TD]260[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]Xavier[/TD]
[TD]Full[/TD]
[TD]A[/TD]
[TD]299[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

For H5 (1st place), I have the following formula:
Code:
{ =IFERROR(INDEX(Name,MATCH(1,(H2=Division)*(H3=Subdivision)*(MAX(IF(Division=H2,IF(Subdivision=H3,Score)))=Score),0)),"") }

For H6 (2nd place), I have the following formula:
Code:
{ =IFERROR(INDEX(Name,MATCH(1,(H2=Division)*(H3=Subdivision)*(LARGE(IF(Division=H2,IF(Subdivision=H3,Score)),2)=Score),0)),"") }


What's happening with these formulas:

Each test in the Lookup Array argument of the MATCH statement returns an array of TRUE/FALSE values. When multiplied together, the array becomes a list of 0s and 1s. So the lookup array in the H5 MATCH formulas is:

{ 0;0;0;0;0;1;0;0;0;0 }

The MATCH matches 1 to the 6th place, returns a 6, thus returns the 6th value from the INDEX.

The MAX and LARGE functions show how you can use array formulas to achieve MAXIFS (or LARGE based on 2+ criteria). See this link for more info: https://exceljet.net/formula/maximum-if-multiple-criteria

Hope that helps!
 
Upvote 0
OK, a few quick comments. First, with the additional criteria, it might be best to rearrange your sheet. Indystick's layout is probably superior to the version I first posted. But it's up to you, if you can show us how you'd like the output to look, names and/or scores, we can work toward that.

Next, Indystick is also correct in that using Named ranges makes the formulas easier to read. He didn't explain how to do it though. The easiest way is to select the range, then type the name you want in the address box (left of the formula box). If need be, we can get fancier and create dynamic ranges, that automatically resize themselves as you add data - or even use a table. Both easy to do, but not used as much as they could be.

Finally, he takes a different approach which is pretty good. It shows the basic idea how to combine multiple conditions, by using the * as a Boolean "and". However, I'd probably replace the ",2" with ROWS($H$4:$H4) so that we can use the same formula and copy it down. The other problem is that if there's a tie for first, the H6 formula will show the same name as H5.
 
Upvote 0
I completely agree with Eric's comments, particularly about using the ROWS (or COLUMNS function if you're copying the formula horizontally) to dynamically determine the place you want to return. I am not sure how the duplicate value issue (e.g., tie for first) could be resolved. Eric, is that what you're addressing with the COUNTIF statements?
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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