## Excel INDEX Function

### How to use the INDEX Function (VBA)

*This Excel tutorial explains how to use the Excel INDEX function with syntax and examples.*

### SUMMARY:

The Excel INDEX function returns the value at a given position in a range or array.

The Microsoft Excel INDEX function returns a value in a table based on the intersection of a row and column position within that table. The first row in the table is row 1 and the first column in the table is column 1.

### PURPOSE:

To get a value in a list or table based on given position.

### RETURN VALUE:

The value from a given location

### SYNTAX 1: (Array form)

Returns the value of an element in a table or an array, selected by the row and column number indexes.Use the array form if the first argument to INDEX is an array constant.

=INDEX(array, row_num, [column_num])

### ARGUMENTS:

The INDEX function syntax has the following arguments:

**array: **Required. A range of cells or an array constant
- If array contains only one row or column, the corresponding row_num or column_num argument is optional.
- If array has more than one row and more than one column, and only row_num or column_num is used, INDEX returns an array of the entire row or column in array.

**row_num: **Required. Selects the row in array from which to return a value. If row_num is omitted, column_num is required.
**col_num: **Optional. Selects the column in array from which to return a value. If column_num is omitted, row_num is required.

### REMARKS:

- If both the row_num and column_num arguments are used, INDEX returns the value in the cell at the intersection of row_num and column_num.
- row_num and column_num must point 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 entire column or row, respectively. To use values returned as an array, enter the INDEX function as an array formula.

Index Function Example (Array form)

*Use of INDEX function to find the value in the intersecting cell where a row and a column meet.*

### SYNTAX 2: (Reference form)

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

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

### ARGUMENTS:

The INDEX function syntax has the following arguments:

**reference: **Required. Required. A reference to one or more cell ranges.
- If you are entering a non-adjacent range for the reference, enclose reference in parentheses.
- If each area in reference contains 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. Selects a range in reference from which to return the intersection of row_num and column_num. The first area selected or entered is numbered 1, the second is 2, and so on. If area_num is omitted, INDEX uses area 1. The areas listed here must all be located on one sheet. If you specify areas that are not on the same sheet as each other, it will cause a #VALUE! error. If you need to use ranges that are located on different sheets from each other, it is recommended that you use the array form of the INDEX function, and use another function to calculate the range that makes up the array. For example, you could use the CHOOSE function to calculate which range will be used.*For example, if Reference describes 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.*

### REMARKS:

- After reference and area_num have selected a particular range, row_num and column_num select 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 set row_num or column_num to 0 (zero), INDEX returns the reference for the entire column or row, respectively.
- row_num, column_num, and area_num must point to a cell within reference; otherwise, INDEX returns a #REF! error. If row_num and column_num are omitted, INDEX returns the area in reference specified by area_num.
- The result of the INDEX function is a reference and is interpreted as such by other formulas. Depending on the formula, the return value of INDEX may be used 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. On the other hand, a formula such as 2*INDEX(A1:B2,1,2) translates the return value of INDEX into the number in cell B1.

Index Function Example (Reference form)

*Use of INDEX function to find the value in the intersecting cell where a row and a column meet from two diffrent range based on selection.*

### Download Example Sample Excel File

index-function-example.xlsx

Useful Links: **
Link 1…
Link 2…
Link 3…
Link 4…
**