Function · Lookup
Excel INDEX function
The Excel INDEX function returns the cell at a row and column you choose. A grocery price list, plus what a row number of 0 does.
Syntax =INDEX(array, row_num, [column_num])
=INDEX(B2:B5,3)Arguments
| Name | Required | What to pass |
|---|---|---|
| array | Required | The range that holds the value you want. |
| row_num | Required | The row inside that range, starting at 1. A 0 returns the whole column, as an array, in current Excel. |
| column_num | Optional | The column inside the range, starting at 1. Omit it when the range is a single column. |
Examples
The third price in a short grocery list
=INDEX(B2:B5,3)Result $4.79
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Item | Price | Row | |
| 2 | Whole milk | 3.49 | 3 | |
| 3 | Eggs | 4.29 | 4.79 | |
| 4 | Oat milk | 4.79 | ||
| 5 | Bread | 3.19 |
INDEX does not search. You tell it the row, and it returns that cell. That sounds weaker than VLOOKUP until the row number comes from MATCH. The pair looks up a value in any column and returns a cell from any other column, to the left or the right.
In the price list, row 3 of B2:B5 is oat milk at $4.79. =MATCH("Oat milk",A2:A5,0) is the 3 you would otherwise type. Nest them when the list grows: =INDEX(B2:B5,MATCH("Oat milk",A2:A5,0)).
A row number of 0 is not “the header.” In current Excel it returns the whole column as an array. Older Excel returns #VALUE!. If you see a spill where you expected one price, the row argument is 0.