Lookup function
INDEX function in Google Sheets and Excel
INDEX returns the value at a given position in a range: the nth item of a list, or the cell at a row and column of a grid.
Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
Syntax
INDEX(array, row_num, [column_num])Arguments in [brackets] are optional. Google Sheets writes it INDEX(reference, [row], [column]).
Example
=INDEX(I2:I8,M1) reads: Return the M1th value (here the 3rd) of the price column I2:I8.
| A | B | C | D | E | F | G | H | I | J | K | L | M | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Order | SKU | Qty | SKU | Product | Price | Stock | Position | 3 | ||||
| 2 | 2001 | PL-104 | 2 | PL-101 | Fern | $9.50 | 40 | Price | $22.00 | ||||
| 3 | 2002 | PT-210 | 1 | PL-104 | Monstera | $34.00 | 12 | ||||||
| 4 | 2003 | TL-301 | 3 | PL-107 | Snake plant | $22.00 | 25 | ||||||
| 5 | 2004 | PL-101 | 1 | PT-210 | Terracotta pot | $12.50 | 60 | ||||||
| 6 | 2005 | SL-401 | 4 | PT-212 | Ceramic pot | $19.00 | 18 | ||||||
| 7 | 2006 | PL-104 | 1 | TL-301 | Watering can | $18.00 | 9 | ||||||
| 8 | 2007 | PT-212 | 2 | SL-401 | Potting mix | $7.25 | 80 | ||||||
| 9 | 2008 | PL-107 | 1 |
M2 shows $22.00: the 3rd price in I2:I8 belongs to the Snake plant.
How the spreadsheet calculates it
Returns the value from I2:I8 at position M1 (1 = the first cell).
- 1. INDEX: Returns the value from
I2:I8at positionM1(1 = the first cell).range=`I2:I8`: the column (or row) to take a value fromn=`M1`: the position
More INDEX examples
=INDEX($C$2:$C$9,MATCH(F2,$A$2:$A$9,0))A lookup in any direction: the value in C on the row where F2 is found in A.=INDEX(B2:E9,3,2)The cell in the 3rd row and 2nd column of the grid.=INDEX(C2:E9,MATCH(I1,A2:A9,0),MATCH(I2,C1:E1,0))A two-way lookup: row by name, column by month.=INDEX(A2:A9,ROWS(A2:A9))The last item of a list.
Paste any of these into the formula explainer to see it step by step.
Tips
- Point INDEX and its MATCH at ranges that start and end on the same rows.
- Use whole-column ranges like
$C:$Cin both INDEX and MATCH if rows get added often, so neither range runs short. - For a two-way lookup, give INDEX a grid and two MATCHes: one for the row, one for the column.
- Remember that INDEX counts from the range's first row, not from row 1 of the sheet.
What INDEX is used for
The return half of INDEX MATCH lookups, picking a cell from a pricing grid by row and column, and returning the nth largest or latest item once another function has found its position.
Arguments
| Argument | Required | What it is |
|---|---|---|
| array | Yes | The range to pick from. |
| row_num | Yes | Which row of the range, counting from 1. Often supplied by MATCH.Watch out: A row past the end of the range gives #REF!. |
| column_num | No | Which column, for a range more than one column wide. |
Common mistakes
Giving a position bigger than the range: #REF!.
Counting from the sheet's row 1 instead of the range's first row: INDEX(I2:I8, 3) is I4.
Pairing it with a MATCH whose range covers different rows, so the position points at the wrong item.
In Google Sheets
Google Sheets has INDEX with the same arguments (it calls them reference, row and column).
Errors you may see with INDEX
Questions
What is INDEX MATCH?
INDEX with MATCH supplying the position: INDEX(return_range, MATCH(key, lookup_range, 0)), a lookup that works in every version. See the INDEX MATCH guide.
Can INDEX return a whole row?
Yes: with column_num 0 (or row_num 0 for a column), INDEX returns the whole row or column of the range.
Why use INDEX instead of just pointing at the cell?
Because the position can come from a formula. INDEX turns a number (from MATCH, ROWS or a calculation) into the value at that position, which is what makes flexible lookups possible.
Sources
Official documentation the facts on this page were checked against.