Generate Top 3 Values and Associated Names with Duplicates

manona

New Member
Joined
Mar 22, 2016
Messages
40
Hi,

I would like to generate a list with the top 3 people with the highest number of incidents in one year (including their name and count).

I have a list of names with their incident counts, but I have trouble listing the top 3 because there are duplicates in the incident counts.

I can't do pivot table or anything manual as this feeds into a chart/dashboard automatically.

Any thoughts are appreciated!

Manon

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A (name)[/TD]
[TD]B (#incidents)[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Peter[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Alex[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Denise[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Sylvie[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Lucie[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Daniel[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Michel[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]TOP 3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]Name[/TD]
[TD]Count[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Why not simply sort the data by Incident and use the first 3 lines in you top 3 section.
you will only ever get the duplicates to appear alphabetically unless there are other criteria

Data sorted

Excel 2007
ABC
1A (name)B (#incidents)
2Sylvie4
3Denise3
4Alex2
5Lucie2
6Michel2
7Peter1
8Daniel1
9
10
11TOP 3
12NameCount
13Sylvie4
14Denise3
15Alex2
16
Sheet1
Cell Formulas
RangeFormula
A13=A2
A14=A3
A15=A4
B13=B2
B14=B3
B15=B4
 
Last edited:
Upvote 0
Hi Michael,

Thank you for your input!

Note also that the list of people and their incident count is also formula driven (to extract unique (name) values from the database and to count their incidents).

Therefore I can do the sort manually now, but I don't think it would automatically update with new entries in the database. I also have 2 'tables' next to one another (one for students and one for teachers), so the sort wouldn't work in this particular case.

Thanks anyways Michael!

Manon
 
Upvote 0
Ok, another option.....BUT in the result of ties, the answer will ALWAYS be the first one found

Excel 2007
AB
4A (name)B (#incidents)
5Peter1
6Alex2
7Denise3
8Sylvie4
9Lucie2
10Daniel1
11Michel2
12
13TOP 3
14NameCount
15Sylvie4
16Denise3
17Alex2
Sheet1
Cell Formulas
RangeFormula
A15=INDEX($A$5:$A$11,MATCH(LARGE($B$5:$B$11,1),$B$5:$B$11,0))
A16=INDEX($A$5:$A$11,MATCH(LARGE($B$5:$B$11,2),$B$5:$B$11,0))
A17=INDEX($A$5:$A$11,MATCH(LARGE($B$5:$B$11,3),$B$5:$B$11,0))
B15=VLOOKUP(A15,$A$5:$B$11,2,0)
B16=VLOOKUP(A16,$A$5:$B$11,2,0)
B17=VLOOKUP(A17,$A$5:$B$11,2,0)
 
Last edited:
Upvote 0
Ah, sorry...I was missing you point..:banghead:

You will need a helper column, like this

Excel 2007
ABC
4A (name)B (#incidents)Ranking
5peter16
6Alex32
7Denise33
8Sylvie41
9Lucie24
10Daniel17
11Michel25
12
13TOP 3
14NameCount
15Sylvie4
16Alex3
17Denise3
18
Sheet1
Cell Formulas
RangeFormula
C5=RANK(B5,$B$5:$B$11)+COUNTIF(B$5:B5,B5)-1
C6=RANK(B6,$B$5:$B$11)+COUNTIF(B$5:B6,B6)-1
C7=RANK(B7,$B$5:$B$11)+COUNTIF(B$5:B7,B7)-1
C8=RANK(B8,$B$5:$B$11)+COUNTIF(B$5:B8,B8)-1
C9=RANK(B9,$B$5:$B$11)+COUNTIF(B$5:B9,B9)-1
C10=RANK(B10,$B$5:$B$11)+COUNTIF(B$5:B10,B10)-1
C11=RANK(B11,$B$5:$B$11)+COUNTIF(B$5:B11,B11)-1
A15=INDEX($A$5:$A$11,MATCH(ROWS($A$2:A2),$C$5:$C$11,0))
A16=INDEX($A$5:$A$11,MATCH(ROWS($A$2:A3),$C$5:$C$11,0))
A17=INDEX($A$5:$A$11,MATCH(ROWS($A$2:A4),$C$5:$C$11,0))
B15=VLOOKUP(A15,$A$5:$B$11,2,0)
B16=VLOOKUP(A16,$A$5:$B$11,2,0)
B17=VLOOKUP(A17,$A$5:$B$11,2,0)
 
Last edited:
Upvote 0

Book1
AB
1A (name)B (#incidents)
2Peter1
3Alex2
4Denise3
5Sylvie4
6Lucie2
7Daniel1
8Michel2
9
10Top3
11Adjusted5
12Top NamesTop Scores
13Sylvie4
14Denise3
15Alex2
16Lucie2
17Michel2
Sheet1


In B11 just enter:

=COUNTIFS(B2:B9,">="&LARGE(B2:B9,MIN(B10,COUNT(B2:B8))))

In A13 control+shift+enter, not just enter, and copy down:

=IF($B13="","",INDEX($A$2:$A$9,SMALL(IF($B$2:$B$9=B13,ROW($B$2:$B$9)-ROW($B$2)+1),COUNTIFS($B$13:B13,B13))))

In B13 just enter and copy down:

=IF(ROWS($B$13:B13)<=$B$11,LARGE($B$2:$B$9,ROWS($B$13:B13)),"")
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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