Practice problems / Lookup & Reference

Find who earns a given salary (INDEX + MATCH)

Hard Lookup & Reference
Description
Hints 0/4
Solutions 2
–
Test case
1
2
3
Reset
Submit
fx
A
B
C
D
E
F
G
1
2
3
4
5
6
7
8
9
10
Loading interactive spreadsheet...
Preparing grid cells and formula calculation engine
○ Ready Enter formula in highlighted cells, then click Submit.

The problem

Problem statement

Payroll flagged one salary amount for audit, but the query came back as a number — you need the person. The roster (A2:C6) keeps names in the first column and salaries in the last, and the amount to trace sits in E2. Return the matching employee's name in the Employee cell F2.

Don't assume the roster order — case 3 shuffles it, so the row number has to be computed.

Problem data

Show the sheet as a table (selectable, copyable)
The exercise data, as a table
ABCEF
1 EmployeeDeptSalarySalaryEmployee
2 Alex ZhangEngineering1850015000
3 Betty LinDesign22000
4 Chris WuSales15000
5 David ChenOperations31000
6 Emma LiuMarketing26000

Notes

This is a reverse lookup: the search key is on the right of the value you want. VLOOKUP cannot look left without a helper column, but MATCH finds the row and INDEX fetches any column from it — the classic interview answer.

How to approach

Your answer goes in F2. On submit we re-run your formula against 3 different sets of input, so a hardcoded number will fail — the formula has to follow the cells.

  1. Target cell is F2
  2. First find WHERE the salary in E2 sits: MATCH(E2, C2:C6, 0) returns its row number
  3. Then fetch the name from that row: INDEX takes the name column and that row number
  4. Shape: =INDEX(?, MATCH(?, ?, 0)) — the MATCH result is the row INDEX needs

Official solutions

Show 2 solutions — try it yourself first

Approach 1: INDEX outer, MATCH inner

=INDEX(A2:A6, MATCH(E2, C2:C6, 0))

MATCH scans the salary column C2:C6 for the exact amount in E2 and returns its position. INDEX then pulls the same-position name from A2:A6. The 0 in MATCH forces exact matching.

Approach 2: XLOOKUP equivalent

=XLOOKUP(E2, C2:C6, A2:A6)

Modern Excel solves the same problem in one call: search C2:C6, return from A2:A6. Worth knowing both — interviews often ask what XLOOKUP replaced.

Function guide

Related practice

FAQ

How do I look left in a table?

Use INDEX + MATCH: =INDEX(A2:A6, MATCH(E2, C2:C6, 0)). MATCH locates the row by the salary, INDEX returns the name from the same row — no helper column needed.

What does the 0 in MATCH mean?

It sets the match type to exact. With 1 or -1, MATCH assumes sorted data and returns an approximate position, which silently produces wrong names here.

Why prefer INDEX/MATCH over VLOOKUP for this?

VLOOKUP only searches the leftmost column of its table and returns columns to the right. When the key sits to the right of the result — like salary here — INDEX/MATCH (or XLOOKUP) is the standard answer.