# How to find the name of the second highest value in Excel

Sort the names by value and pick the one at that rank: `=INDEX(SORTBY(A2:A9,B2:B9,-1),E1)`, with 2 in E1.

**Excel:** `=INDEX(SORTBY(A2:A9,B2:B9,-1),E1)` (Excel 2021, 2024 and Microsoft 365)

**Google Sheets:** `=INDEX(SORT(A2:B9,2,FALSE),E1,1)`

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| Student | Score |  | Rank | 2 |
| Ava | 88 |  | Name |  |
| Ben | 94 |  |  |  |
| Chloe | 79 |  |  |  |
| Dan | 91 |  |  |  |
| Eve | 85 |  |  |  |
| Finn | 97 |  |  |  |
| Gia | 73 |  |  |  |
| Hugo | 82 |  |  |  |

Formula in E2: `=INDEX(SORTBY(A2:A9,B2:B9,-1),E1)`

Result: Ben

## How it works

SORTBY puts the names in order of score, highest first: Finn, Ben, Dan, and so on. INDEX picks the name at the rank in `E1`. Because each name keeps its own position, two students with the same score both appear, one after the other.

Google Sheets has no SORTBY; SORT the two columns by column 2 and take the first column.

## Other ways

- `=INDEX(A2:A9,MATCH(LARGE(B2:B9,E1),B2:B9,0))`: Every Excel version: LARGE finds the 2nd-highest score and MATCH finds its row. With tied scores it returns the same name twice.
- `=XLOOKUP(LARGE(B2:B9,E1),B2:B9,A2:A9)`: The XLOOKUP form of the same idea, with the same weakness on ties.

## Common mistakes

- With tied scores, LARGE returns the same score for ranks 2 and 3, and a lookup returns the first student both times. SORTBY gives each student a place.
- A rank larger than the number of students returns #REF!.

## Questions

**How do I list the top 3 names?**

Take the first three: `=TAKE(SORTBY(A2:A9,B2:B9,-1),3)`.

**How do I find the second lowest?**

Sort ascending: `=INDEX(SORTBY(A2:A9,B2:B9,1),2)`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/name-of-nth-highest-value
