The INDEX function returns a value or the reference to a value from inside a table or range.

There are two approaches to use the INDEX function:

- If you want to return the value of a particular cell or array of cells, see Array form.
- If you want to return a reference to defined cells, see Reference form.

## Array Form – INDEX Function

### Description

Returns the value of a table or array element, picked by the row and column number indexes.

Use the array form if the initial argument to INDEX is an array constant.

### Syntax of the INDEX Function

**INDEX(array, row_num, [column_num])**

The array form of the INDEX function includes the following arguments:

**array**– Required. A range of cells or an array constant.- If array has only one row or column, the matching row_num or column_num argument is optional.
- If array contains several rows and columns, and just row_num or column_num is used, INDEX captures an array of the whole row or column in array.

**row_num**– Required, unless column_num is present. Chooses the row in array from which to return a value. If row_num is skipped, column_num is needed.**column_num**– Optional. Picks the column in array from which to return a value. If column_num is ignored, row_num is essential.

### Remarks of the Array Form of the INDEX Function

- If both the row_num and column_num arguments are used, INDEX returns the value within the cell at the intersection of row_num and column_num.
- row_num and column_num has to direct to a cell within array; otherwise, INDEX returns a #REF! error.
- If you set row_num or column_num to 0 (zero), INDEX returns the array of values for the complete column or row, respectively. To use values returned as an array, type the INDEX function as an array formula.

**Note:** If you have a current version of Microsoft 365, then you can enter the formula in the top-left-cell of the output range, then press **ENTER **to verify the formula as a dynamic array formula. Otherwise, the formula should be typed as a legacy array formula by first picking the output range, specify the formula in the top-left-cell of the output range, then press **CTRL+SHIFT+ENTER** to approve it. Excel adds curly brackets at the start and ending of the formula for you. For further information on array formulas, see Guidelines and examples of array formulas.

## Examples

### Example 1 of the Array Form of the INDEX Function

These examples use the INDEX function to find the value in the intersecting cell where a row and a column meet.

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press **F2**, and then press **Enter**.

Data | Data | |
---|---|---|

Apples | Lemons | |

Bananas | Pears | |

Formula | Description | Result |

=INDEX(A2:B3,2,2) | Value at the intersection of the second row and second column in the range A2:B3. | Pears |

=INDEX(A2:B3,2,1) | Value at the intersection of the second row and first column in the range A2:B3. | Bananas |

### Example 2

This example uses the INDEX function in an array formula to track down the values in two cells defined in a 2×2 array.

**Note:** If you have a current version of Microsoft 365, then you can input the formula in the top-left-cell of the output range, then press **ENTER **to confirm the formula as a dynamic array formula. Otherwise, the formula must be entered as a legacy array formula by first selecting two blank cells. Then, input the formula in the top-left-cell of the output range, then press **CTRL+SHIFT+ENTER** to confirm it. Excel inserts curly brackets at the beginning and end of the formula for you. For more information on array formulas, see Guidelines and examples of array formulas.

Formula | Description | Result |
---|---|---|

=INDEX({1,2;3,4},0,2) | Value found in the first row, second column in the array. The array contains 1 and 2 in the first row and 3 and 4 in the second row. | 2 |

Value found in the second row, second column in the array (same array as above). | 4 |

Reference form of the INDEX Function

### Description

Returns the reference of the cell at the intersection of a particular row and column. If the reference is composed of non-adjacent selections, you can choose the selection to look in.

### Syntax of the Reference Form of the INDEX Function

**INDEX(reference, row_num, [column_num], [area_num])**

The reference form of the INDEX function includes the following arguments:

**reference**– Required. A reference to one or multiple cell ranges.- If you are typing a non-adjacent range for the reference, surround reference in parentheses.
- If each area in reference includes only one row or column, the row_num or column_num argument, respectively, is optional. For example, for a single row reference, use INDEX(reference,,column_num).

**row_num**– Required. The number of the row in reference from which to return a reference.**column_num**– Optional. The number of the column in reference from which to return a reference.**area_num**– Optional. Chooses a range in reference from which to return the intersection of row_num and column_num. The first area picked or typed is numbered 1, the second is 2, and so on. If area_num is skipped, INDEX uses area 1. The areas displayed here must all be based on one sheet. If you define areas that are on different sheets, it will lead to a #VALUE! error. If you must use ranges that are found on various sheets from each other, it is highly advisable that you use the array form of the INDEX function, and use a different function to calculate the range that forms the array. For example, you might use the CHOOSE function to calculate which range will be used.

For example, if Reference outlines the cells (A1:B4,D1:E4,G1:H4), area_num 1 is the range A1:B4, area_num 2 is the range D1:E4, and area_num 3 is the range G1:H4.7

### Remarks of the Reference Form of the INDEX Function

- After reference and area_num have chosen a specific range, row_num and column_num confirm a particular cell: row_num 1 is the first row in the range, column_num 1 is the first column, and so on. The reference returned by INDEX is the intersection of row_num and column_num.
- If you define row_num or column_num to 0 (zero), INDEX returns the reference for the whole column or row, respectively.
- row_num, column_num, and area_num must aim at a cell within reference; otherwise, INDEX returns a #REF! error. If row_num and column_num are skipped, INDEX returns the area in reference elaborated by area_num.
- The result of the INDEX function is a reference and is interpreted this way by other formulas. Depending on the formula, the return value of INDEX could be relayed as a reference or as a value. For example, the formula CELL(“width”,INDEX(A1:B2,1,2)) is equivalent to CELL(“width”,B1). The CELL function uses the return value of INDEX as a cell reference. Conversely, a formula like 2*INDEX(A1:B2,1,2) translates the return value of INDEX into the number in cell B1.

## Examples

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter.

Fruit | Price | Count |
---|---|---|

Apples | $0.69 | 40 |

Bananas | $0.34 | 38 |

Lemons | $0.55 | 15 |

Oranges | $0.25 | 25 |

Pears | $0.59 | 40 |

Almonds | $2.80 | 10 |

Cashews | $3.55 | 16 |

Peanuts | $1.25 | 20 |

Walnuts | $1.75 | 12 |

Formula | Description | Result |

=INDEX(A2:C6, 2, 3) | The intersection of the second row and third column in the range A2:C6, which is the contents of cell C3. | 38 |

=INDEX((A1:C6, A8:C11), 2, 2, 2) | The intersection of the second row and second column in the second area of A8:C11, which is the contents of cell B9. | 1.25 |

=SUM(INDEX(A1:C11, 0, 3, 1)) | The sum of the third column in the first area of the range A1:C11, which is the sum of C1:C11. | 216 |

=SUM(B2:INDEX(A2:C6, 5, 2)) | The sum of the range starting at B2, and ending at the intersection of the fifth row and the second column of the range A2:A6, which is the sum of B2:B6. | 2.42 |

## See Also

Guidelines and examples of array formulas

Lookup and reference functions (reference)