What is the INDEX function?
=INDEX(array, row_num, [column_num])INDEX returns the value at a given position inside a range. It doesn't search for anything; you tell it the row and column numbers and it goes straight there.
The numbers are counted inside the range, not on the sheet. If the range starts at row 2, row 2 of the sheet is row_num 1.
On its own INDEX is simple. Combined with MATCH, which finds the position of a value, it becomes a flexible lookup that works in every Excel version.
Arguments
- array
- The range to pick a value from.
- row_num
- The row position inside array. The first row is 1.
- column_num
- The column position inside array. You can leave it out when array is a single column.
INDEX examples
Example 1. Get the 4th row, 3rd column
=INDEX(A2:D9, 4, 3)The 4th row of the range is P004 and the 3rd column is Price, so the result is 6900.
Example 2. INDEX with MATCH
=INDEX(C2:C9, MATCH("Eggs", B2:B9, 0))MATCH finds that Eggs is in position 4, and INDEX returns the 4th value of the Price column, 6900. The return column can be anywhere, even to the left.
Common mistakes
Counting from the top of the sheet
row_num counts from the first row of array. With A2:D9, sheet row 5 is row_num 4.
Numbers outside the range
A row_num larger than the number of rows in array returns #REF!.
FAQ
- Why use INDEX/MATCH instead of VLOOKUP?
- It can return a column on either side, it doesn't break when columns are inserted, and it works in every Excel version.