formulastreak

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

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.

Orders and price list · edit M2 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultM2 = $22.00
ABCDEFGHIJKLM
1OrderSKUQtySKUProductPriceStockPosition3
22001PL-1042PL-101Fern$9.5040Price$22.00
32002PT-2101PL-104Monstera$34.0012
42003TL-3013PL-107Snake plant$22.0025
52004PL-1011PT-210Terracotta pot$12.5060
62005SL-4014PT-212Ceramic pot$19.0018
72006PL-1041TL-301Watering can$18.009
82007PT-2122SL-401Potting mix$7.2580
92008PL-1071

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. 1. INDEX: Returns the value from I2:I8 at position M1 (1 = the first cell).
    • range = `I2:I8`: the column (or row) to take a value from
    • n = `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:$C in 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

ArgumentRequiredWhat it is
arrayYesThe range to pick from.
row_numYesWhich row of the range, counting from 1. Often supplied by MATCH.Watch out: A row past the end of the range gives #REF!.
column_numNoWhich 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

  • #REF!: row_num or column_num is outside the range, like asking for row 5 of a 4-row range.
  • #N/A: In INDEX MATCH, the MATCH part couldn't find its value.

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.

Practise INDEX on a live sheet

Lesson 16, INDEX and MATCH (Unit 4, Lookups), has 5 graded exercises, checked instantly, with steps and hints when you're stuck. Pro