How to find the highest value and return the name in Excel
SheetFluent team · · 6 min read
To return the name next to the highest value, find the highest value with MAX, then look it up with XLOOKUP: =XLOOKUP(. In words: find the biggest number in B2:B6, find where it sits, and bring back the name from the same row of A2:A6. In older Excel without XLOOKUP, use =INDEX(, which gives the same answer.
=XLOOKUP(MAX(B2:B6),B2:B6,A2:A6)
Why MAX alone is not enough
MAX answers "what is the biggest number?" It does not answer "who has it?" If B2:B6 holds test marks, =MAX( gives you 91, not the student who scored 91.
To get the name, you need two steps. First find the highest value. Then find the row that value is in and read across to the name column. A lookup function does the second step, so the formula puts MAX inside a lookup.
The example below uses five students and their marks: Maya 78, Jordan 91, Priya 85, Luis 67 and Grace 88. Names are in A2:A6 and marks are in B2:B6. The answer we want is Jordan.
Step by step with XLOOKUP
XLOOKUP takes three parts: what to look for, where to look for it, and what to bring back. Here, what to look for is the highest mark, so the first part is MAX(.
1. Click the cell where you want the name, for example D2.
2. Type =XLOOKUP( and then MAX( for the value to find. Type a comma.
3. Select the marks again, B2:B6. This is where XLOOKUP searches for 91. Type a comma.
4. Select the names, A2:A6. This is the column XLOOKUP reads the answer from. Close the parentheses and press Enter.
The finished formula reads: "find the highest mark, look for it in the marks column, and return the name on that row." The second and third ranges must be the same size and start on the same row, or the name you get back will be from the wrong row.
=XLOOKUP(MAX(B2:B6),B2:B6,A2:A6)The same thing with INDEX and MATCH
XLOOKUP is in Excel 2021, Excel for Microsoft 365, Excel for the web and Google Sheets. If your workplace uses Excel 2019 or older, XLOOKUP gives a #NAME? error. INDEX and MATCH work in every version.
MATCH finds the position of a value in a range. MATCH( returns 2, because 91 is the second mark in the list. The 0 at the end means "exact match only". Leave it out and MATCH may return the wrong position.
INDEX then takes the name at that position: =INDEX( is Jordan. Put the MATCH inside the INDEX and you have one formula that keeps working when the marks change.
=INDEX(A2:A6,MATCH(MAX(B2:B6),B2:B6,0))See also: Look up with INDEX and MATCH, XLOOKUP and INDEX MATCH with multiple criteria in Excel
Why VLOOKUP usually does not work here
VLOOKUP only looks to the right. It searches the first column of a table and returns a value from a column further right. In most lists the names come first and the numbers come after, so VLOOKUP would need to look left, which it cannot do.
If your sheet happens to have the numbers in the first column and the names to the right, =VLOOKUP( works. For any other layout, use XLOOKUP or INDEX and MATCH, and you won't need to move columns around.
Lowest value, top three, and values with a condition
For the lowest value, swap MAX for MIN: =XLOOKUP( returns Luis. Everything else stays the same.
For second or third place, use LARGE instead of MAX. LARGE( is the second-highest mark, so =XLOOKUP( returns Grace. Our guide to LARGE, SMALL and MEDIAN covers this in more detail.
For the highest value within a group, such as the top seller in the East region, MAX is not enough on its own because it looks at every row. MAXIFS finds the highest value that meets a condition, and our MAXIFS and MINIFS lesson shows how to use it.
=XLOOKUP(MIN(B2:B6),B2:B6,A2:A6)
=XLOOKUP(LARGE(B2:B6,2),B2:B6,A2:A6)What happens with a tie
If two people share the highest value, XLOOKUP and MATCH both return the first one they reach, reading from the top. The second name is not shown, and nothing warns you.
To check for a tie, count how many times the highest value appears: =COUNTIF(. If the answer is more than 1, there is a tie, and you can decide what to show. For example, =IF( shows the word Tie instead of picking one name.
In Excel 365 and Google Sheets, FILTER can list every name that shares the top value. That spills into several cells, so leave empty cells below the formula.
Common mistakes and how to fix them
The formula returns a number, not a name. The third range points at the numbers. Make it the names column, A2:A6. (If the second and third ranges are swapped, XLOOKUP searches the names for a number and returns #N/A.)
The formula returns the wrong name. The two ranges probably start on different rows, such as B2:B6 and A3:A7. Make them start and end on the same rows.
#N/A. The value from MAX was not found in the search range. This happens when MAX looks at one range and XLOOKUP searches another. Use the same range in both places.
The highest value is ignored. The number may be stored as text, often after pasting from another system. MAX skips text, so the real top value is left out. Our lesson on converting text to numbers shows how to fix that.
Return the name in Google Sheets
Google Sheets has XLOOKUP, INDEX and MATCH, so every formula on this page works there as written. Type it the same way, press Enter, and Sheets shows the name.
Sheets also offers a short alternative with SORTN, which sorts a table and keeps the top rows. That is useful for a quick look, but it only exists in Sheets, so stick with XLOOKUP or INDEX and MATCH in a file that will also be opened in Excel.
Whichever app you use, test the formula once by changing a number. Raise Luis to 95 and the answer should switch from Jordan to Luis. If it doesn't, check that calculation is set to Automatic and that every range covers the same rows.
Try it here
Type the formula into the answer cell, then press Enter or Check.
In C2, return the name of the student with the highest mark. Finish the formula: the highest mark is MAX(.
| A | B | C | |
|---|---|---|---|
| 1 | Student | Marks | Top |
| 2 | Maya | 78 | =XLOOKUP(MAX(B2:B6), (answer cell) |
| 3 | Jordan | 91 | |
| 4 | Priya | 85 | |
| 5 | Luis | 67 | |
| 6 | Grace | 88 |
In C2, return the name of the student with the highest mark. Finish the formula: the highest mark is MAX(.
Questions people ask
How do I return the name with the lowest value instead?
Replace MAX with MIN: =XLOOKUP(. The rest of the formula stays the same.
What if two people have the same highest value?
XLOOKUP and INDEX MATCH return the first one from the top. Use =COUNTIF( to check: an answer above 1 means there is a tie.
Does this work in Google Sheets?
Yes. Google Sheets has XLOOKUP, INDEX and MATCH, and the formulas on this page work there as written.
Can I use VLOOKUP to return the name of the max value?
Only if the numbers are in the first column and the names are to their right. VLOOKUP cannot look left, so for the usual layout use XLOOKUP or INDEX and MATCH.
Keep practicing
Practice this in the full lesson: Look up in any direction with XLOOKUP
Related articles
Look up a value that matches two conditions in Excel: join them with & in a helper column, then use XLOOKUP or INDEX MATCH.
Work out a weighted average in Excel: multiply each value by its weight, add them up, divide by the total weight. Works in Google Sheets too.
- Excel formulas cheat sheet7 min read
The Excel formulas you'll use most, grouped by job: totals, counting, conditions, lookups, text and rounding, each with an example. Print or save as PDF.