INDEX
Return the value at a given row and column position in a range with Excel's INDEX function.
Spreadsheet editor
Spreadsheet editor
Syntax
=INDEX(array, row_num, [column_num])
Returns: Varies Arguments
| Argument | Required | Description |
|---|---|---|
| array | Yes | The range of cells or array from which you want to retrieve a value. |
| row_num | Yes | The row position within the array to return. Counts from the first row of the array. Set it to 0 to return the entire column. |
| column_num | No | The column position within the array to return. Needed when the array has more than one column. Set it to 0 to return the entire row. |
About
On its own INDEX is handy when you already know a position. Its real power shows up when you pair it with MATCH, which finds a position for you. Together, INDEX and MATCH can look up values in any direction, including to the left, which is something VLOOKUP cannot do.
Use INDEX when you need flexible lookups across rows and columns, two-way lookups in a grid, or when you want to pull a value by position from a list. In newer versions, XLOOKUP covers many of the same jobs, but INDEX with MATCH still works everywhere, even in older Excel versions.
Exercises using INDEX
INDEX-MATCH left lookup
IntermediateFind a customer's email address where email is to the LEFT of customer ID.
Open exerciseINDEX-MATCH with MATCH in both directions
IntermediateUse INDEX with two MATCH functions to return a value from a shipping rate grid.
Open exerciseLook up a manager with INDEX+MATCH
IntermediateLook up an employee's manager using INDEX-MATCH (lookup value not in first column).
Open exerciseTwo-way lookup
AdvancedFind the price at the intersection of product and region in a matrix.
Open exerciseSee a INDEX formula step by step
Watch each part of the formula with live results of every step in a formula walkthrough.
INDEX MATCH explained step by step
=INDEX(C2:C8,MATCH("Alice",A2:A8,0)) See how MATCH finds Alice's row and INDEX returns her salary, with both results calculated live.
See the stepsINDEX MATCH with multiple criteria
=INDEX(C2:C8,MATCH(1,(A2:A8="Widget")*(B2:B8="West"),0)) See product and region tests become Boolean arrays, combine into one mask, and resolve to a price.
See the stepsExamples
Look up a value to the left with INDEX and MATCH
Spreadsheet editor
Two-way lookup in a sales grid
Spreadsheet editor
Watch out for
Counting from the worksheet instead of the array
People expect row_num 5 to mean worksheet row 5, then get the wrong value.
→ Row and column numbers count from the first cell of the array. In =INDEX(B10:B20, 1), the 1 points to B10, not row 1 of the sheet.
Position outside the range returns #REF!
Asking for row 12 in a 10-row range, or a column that doesn't exist, gives a #REF! error.
→ Keep row_num and column_num within the size of the array. When pairing with MATCH, this usually means the lookup value wasn't found, so check your data.
Missing the column number in a grid
Using only row_num on a range with several columns returns the whole row as an array, not a single cell.
→ Add column_num when the array spans more than one column, for example =INDEX(B2:E13, 5, 3) to land on one cell.
Swapping the row and column arguments
In INDEX and MATCH setups it's easy to put the column MATCH where the row MATCH belongs, returning a value from the wrong spot.
→ The order is row first, then column. The MATCH that searches down a column feeds row_num; the MATCH that searches across a row feeds column_num.
Tips & notes
The extra area_num argument only applies to the reference form. It picks which of the grouped ranges to look in (1 for the first, 2 for the second, and so on), so =INDEX((A1:A10, C1:C10), 3, 1, 2) returns the third cell of the second range, C3. Leave area_num out and INDEX defaults to the first range.
One more trick: INDEX returns an actual reference, not just a value, so you can drop it into the middle of a range. =SUM(B2:INDEX(B2:B100, 10)) sums B2 down to whatever cell INDEX points at, which is handy for building ranges that grow or shrink based on a formula.