What INDEX does

INDEX returns the value at a given position in a range: the third name in a list, or the value in row 3, column 2 of a table. You give it the range, a row number and, for a table, a column number, and it counts down and across to the cell. =INDEX(B2:D5,3,2) returns what’s in C4.

On its own that sounds modest, because you usually don’t know the position in advance. Its strength shows when another function works the position out. Paired with MATCH, which finds where a value is, INDEX becomes a lookup that can look in any direction. INDEX with MATCH was the standard way to look things up long before XLOOKUP.

Positions count from the range. In B2:D5, row 1 is sheet row 2 and column 1 is column B.

Syntax

=INDEX(array, row_num, [column_num])
Arguments in square brackets are optional; the rest are required.
arrayRequired
The range to take the value from, such as A2:A7 or a whole table like B2:D5.
row_numRequired
Which row of the range, counting from 1 at its top. Often a MATCH that works the position out.
column_numOptional
Which column of the range, counting from 1 at its left. You need it only when the range is more than one column wide.

Example: the third person in a list

The order people booked in is in A2 to A7. To find who was third:

Position 3 of A2:A7 is A4, which holds Cleo. In C2, =INDEX(A2:A7,3) returns Cleo.

With a single column, one number is enough: INDEX counts that many rows down.

Example: a rate from a two-way table

Courier rates depend on the weight band (rows) and the zone (columns). INDEX picks the rate at row 3, column 2 of the table.

Row 3 of the table is Up to 10 kg; column 2 is Zone 2. In B6, =INDEX(B2:D5,3,2) returns 14.00.

In a real rate sheet, the 3 and the 2 would come from MATCH, which finds the band and the zone from what someone types. With the weight band in G1 and the zone in G2, =INDEX(B2:D5,MATCH(G1,A2:A5,0),MATCH(G2,B1:D1,0)) returns the rate where that row and that column cross.

Common mistakes

  • In INDEX(B2:D5,3,2), row 3 is sheet row 4, because positions count from the top-left cell of the range.
  • Asking for row 7 of a six-row range gives #REF!. That often means MATCH found something in a longer list than the INDEX range.
  • With MATCH, the range MATCH searches and the range INDEX returns from must start on the same row, or every answer comes from the wrong row.
  • The row comes first, then the column. INDEX(B2:D5,2,3) is a different cell from INDEX(B2:D5,3,2).

Frequently asked questions

What is the difference between INDEX and MATCH?

MATCH finds where a value is and returns its position, such as 4. INDEX works the other way around: give it a position and it returns the value there. Together they make a lookup, with MATCH finding the row and INDEX returning the value from it.

Can INDEX return a whole row or column?

Yes. A row number of 0 returns the whole column, and a column number of 0 returns the whole row, which you can then add up, for example with =SUM(INDEX(B2:D5,0,2)).

Does INDEX work across rows as well as down columns?

Yes. For a range one row high, such as B1:M1, a single number counts across: =INDEX(B1:M1,4) returns the fourth cell.

Why does INDEX return #REF!?

The row or column number points outside the range, such as row 7 of a six-row range. When the number comes from MATCH, check that MATCH searches a list no longer than the range INDEX returns from.

What is the area number in INDEX?

It belongs to INDEX’s reference form, where the first argument is several ranges in brackets. The area number picks one of them: =INDEX((A2:C6,E2:G6),2,3,2) returns row 2, column 3 of the second range, E2:G6, which is cell G3.