Home > Back-end >  Find name of the person ranked 1 - Google Sheets
Find name of the person ranked 1 - Google Sheets

Time:07-03

What I'm trying to do is find the name of the person who is ranked number 1. I have tried =lookup and =vlookup but I get an error saying it cant be found although its obviously there. I assume that im either using the wrong function or just not using it right.

I tried =VLOOKUP(1;D2:H19;1) and =LOOKUP(1;D2:H19;1) but it dosen't seem to work.

Image of the table which contains data and names ( a few other things)

CodePudding user response:

Answer

The following formula should produce the behaviour you desire:

=INDEX(D2:D,MATCH(1,H2:H,0))

Explanation

=VLOOKUP can only be used to find values to the right of a search key. To find values to the left of a search key, use a combination of =INDEX and =MATCH.

The =MATCH function searches a specified range for a specified value and returns the relative position of the value in that range. In this case, the value to search for is 1, the range to search through is H2:H, and the 0 at the end specifies that the range is not sorted in any way.

The =INDEX function returns the contents of a cell within a range having a specified row and column offset. In this case, the range is D2:D, and the row is whichever row is returned by =MATCH. =INDEX could take a third argument if it was desired to specify a row offset as well, but that is not necessary here.

Functions used:

CodePudding user response:

You sort your ascending order based on rank then return your desired data using INDEX() function. Try-

=INDEX(SORT(D2:H500,5,1),1,1)

CodePudding user response:

=vlookup(1,{H2:H19, D2:D19},2)

Since vlookup only searches the 1st column of the input range, to use it, you need to flip the columns by composing a local array: {H2:H19, D2:D19}.

{} means concatenation. , in it means horizontal concatenation. With that, the rank column is now the 1st column in the input of vlookup and now vlookup works.

With our local array, the 2nd column are the names and therefore index should be 2.

Also note the use of comma to separate function inputs.

  • Related