Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel: Get Top 3 Values and Names

I am trying to get the top 3 distinct Scores(result of a formula) as well as the names of the analysts who got those (3 highest)scores. I've tried using RANK, SORT, LARGE and all give me weird results.

This is the result I am going for. Note that the number of analysts per score varies.

desiredresult

Here's what I get using RANK.

rank

Here's what I get using SORT.

sort

Here's what I get using LARGE

large

I am not sure what I am doing wrong. Maybe I'm using the wrong function so I'd appreciate a lot if anyone can point me to the right direction.

like image 465
KarenDP Avatar asked Dec 14 '22 09:12

KarenDP


2 Answers

Option with AGGREGATE function:

=AGGREGATE(14,6,($B$2:$B$11)*(COUNTIF($D$1:D1,$B$2:$B$11)=0),1)

enter image description here

Additionally, to get names:

=IFERROR(INDEX($A$2:$A$11,AGGREGATE(15,6,(1/($D2=$B$2:$B$11))*ROW($B$2:$B$11)-1,COLUMN()-COLUMN($D$2))),"")

enter image description here

like image 158
basic Avatar answered Dec 23 '22 19:12

basic


Here is a solution using MAX. The second and third are array formulas.

enter image description here

Get the largest value:

=MAX(C2:C11)

Get the largest value that is smaller than the value above (E2 is the cell above):

{=MAX(IF($C$2:$C$11<E2,$C$2:$C$11))}

Get the largest value that is smaller than the value above (E3 is the cell above):

{=MAX(IF($C$2:$C$11<E3,$C$2:$C$11))}
like image 35
DenverCoder1 Avatar answered Dec 23 '22 20:12

DenverCoder1