# INDEX Function in☝️ Google Sheets Explained (Definition, Syntax, How to Use It, Examples)

This guide covers everything you need to know about the Google Sheets INDEX function, including its definition, syntax, use cases, and how to use it.

## What is the INDEX Function? How Does It Work?

The INDEX function in Google Sheets returns the content of a cell specified by row and column offset. It is primarily used to retrieve specific data from a larger dataset or range of cells. For instance, if you have a spreadsheet filled with guest names, dietary restrictions, invitation statuses, and table numbers, you can use the INDEX function to pull out precise details like a specific guest’s name or dietary restriction.

The function works by taking a reference to a range of cells as well as an optional row or column index. If you specify both a row and column index, INDEX will return the content of the cell at that exact intersection. For example, in a dataset ranging from A2 to D6, the formula “=INDEX(A2:D6, 2, 1)” would return the cell’s content found at the second row and first column within that range.

The INDEX function can also return an array of values if either the row or column index is set to 0. For example, if you input “=INDEX(A2:D6, 2, 0)”, the function will return all values in the second row across the entire column range. Similarly, “=INDEX(A2:D6, 0, 4)” will provide an array of all values in the fourth column across the entire row range.

Additionally, the INDEX function can be paired with the MATCH function for more complex and dynamic data retrieval. The MATCH function returns the relative position of a specific value in a range, and when used in combination with INDEX, it can dynamically locate and return data from any position within the dataset. This makes the combination of INDEX and MATCH a powerful alternative to the VLOOKUP function, especially in cases where the lookup value is not positioned to the left of the desired attribute to return.

## INDEX Syntax

The syntax and arguments for the function are as follows:

INDEX(reference, [row], [column])

Here’s what each argument means:

• reference: This is the range of cells from which the values are returned. It is a required argument. You need to specify the cell range that you’re working with.
• [row]: This argument is optional. It represents the index of the row within the reference range of cells you want to return. If you leave it blank or set it to 0, INDEX will return the array of values for the entire column.
• [column]: This argument is also optional. It signifies the index of the column within the reference range of cells that you want to return. If you leave it blank or set it to 0, INDEX will return the array of values for the entire row.

Here are some important usage notes related to the syntax and arguments of the INDEX function:

• The row and column numbers are counted from the first cell in the range specified in the reference argument, not from the first cell of the spreadsheet.
• If both the [row] and [column] arguments are set to 0, INDEX will return the array of the entire range specified in the reference.
• The INDEX function will return an error if the [row] or [column] argument exceeds the size of the range specified in the reference.
• If you only specify the reference argument and leave both [row] and [column] arguments blank, INDEX will return the top-left cell of the range.
• The INDEX function in Google Sheets is not case-sensitive. It treats lowercase and uppercase text as the same.
• If the specified row or column index doesn’t exist in the selected range, the INDEX function will return a #REF! error.
• The INDEX function can work with ranges spanning multiple sheets, but all sheets must be in the same Google Sheets file.

## Examples of How to Use the INDEX Function

Here are some practical examples showcasing the use of the INDEX function in Google Sheets:

### Example #1: Basic INDEX function

Let’s say you have a list of names in a column from A1 to A10, and you want to retrieve the 5th name from the list. You can use the INDEX function as follows: =INDEX(A1:A10, 5). This formula will return the name in the 5th row of your specified range.

### Example #2: INDEX with two-dimensional range

Consider you have a table with names in column A (from A2 to A6) and their corresponding ages in column B (from B2 to B6). If you want to find the age of the person listed in the 3rd row, you can use the INDEX function as follows: =INDEX(A2:B6, 3, 2). This formula will return the age of the person in the 3rd row because you specified 2 as the column number, which refers to the age column.

### Example #4: INDEX with dynamic end range

If your data range changes often and you want your INDEX function to be dynamic, you can use the COUNTA function to determine the end of your range. For instance, if you want to retrieve the last name in your list, you can use the formula: =INDEX(A1:A100, COUNTA(A1:A100)). The COUNTA function counts the number of cells in the range that are not empty and returns that value to the INDEX function as the row number to retrieve.

### Example #5: INDEX with multiple criteria

If you need to match multiple criteria, you can use the INDEX function with the MATCH and ARRAYFORMULA functions. Let’s say you have a table with names in column A, ages in column B, and cities in column C.

If you want to find the age of “John” who lives in “New York”, you can use the following formula: =INDEX(B2:B6, MATCH(1, (A2:A6=”John”)*(C2:C6=”New York”), 0)). The ARRAYFORMULA function creates an array where each cell is 1 if both conditions are met and 0 otherwise. The MATCH function then finds the row where the array equals 1 while the INDEX function retrieves the age from that row.

## INDEX: Common Mistakes & Problems

When using the INDEX function in Google Sheets, you might encounter some common mistakes and problems. Understanding these issues can help you avoid them and use the function more efficiently.

• Incorrect Argument Order: One of the most common mistakes is entering arguments in the wrong order. The INDEX function requires the array first, the row number, and the column number. Mixing up this order can lead to errors or incorrect results.
• Incorrect Range Selection: If the range of cells selected in the array doesn’t contain the cell you’re trying to reference, the INDEX function will return an error. It’s crucial to ensure the array includes the cell you want to index.
• Using Zero as Row or Column Number: Using zero as a row or column number in the INDEX function will return the entire row or column respectively. However, if you intended to reference a specific cell, this can lead to unexpected results.
• Non-Numeric Row or Column References: The INDEX function requires numeric values for the row and column references. Using non-numeric references will result in an error.
• Out of Bounds References: The INDEX function will return an error if the row or column number you’re trying to reference is larger than the number of rows or columns in the array. This is referred to as an “out of bounds” reference.
• Ignoring the Importance of Absolute References: When copying and pasting cells containing the INDEX function, relative references can change based on their new location. If you want to maintain the same reference, you need to use absolute references.
• Not Accounting for Hidden Rows or Columns: The INDEX function includes hidden rows and columns in its count. If you’re not aware of this, it can lead to errors in your results.

## Why Is INDEX Not Working? Troubleshooting Common Errors

If you are experiencing problems while using the INDEX function in Google Sheets, it could be due to several reasons. This section will cover some of the most common errors, their causes, and how to fix them.

### #VALUE! Error

Cause: This error typically occurs when the function’s input or parameters are incorrect. For instance, you might have referenced a row or column that doesn’t exist in the specified range or supplied an argument that the function doesn’t understand.

Solution: To fix this, ensure your function’s arguments are correct. Pay close attention to the range you’re referencing and ensure that the row or column index exists within that range. If you’re using a formula to generate the row or column index, check to ensure it produces a valid result.

### #REF! Error

Cause: The #REF! error usually occurs when the referenced cell in the INDEX function does not exist. This may happen if you deleted a row, column, or worksheet the function referenced.

Solution: To resolve this error, you need to edit your function to reference an existing cell. If the referenced cell was deleted, you might need to recreate it or adjust your function to reference a different cell.

### #N/A Error

Cause: This error can occur when the INDEX function cannot find the value you’re looking for. This might happen if the function is looking for a specific value in a range, but that value doesn’t exist.

Solution: To fix this error, you need to ensure the value you’re looking for exists within the specified range. If you’re using a formula to generate the lookup value, ensure it produces the correct result.

### #NUM! Error

Cause: The #NUM! error often happens when the row or column index number is less than 1, or greater than the number of rows or columns in the range.

Solution: To resolve this error, ensure that your row or column index number is within the range of existing rows or columns. Check your function to make sure you’re not referencing a row or column index that doesn’t exist.

### #ERROR! Error

Cause: The #ERROR! error is a general error that can occur for a variety of reasons, often due to incorrect syntax or invalid arguments.

Solution: To fix this error, check your function for common mistakes. Ensure you’ve used the correct syntax and all your arguments are valid. Referring back to the syntax and examples provided earlier in this post might be helpful to ensure that your function is structured correctly.

## Using INDEX With Other Google Sheets Functions

Combining the INDEX function with other Google Sheets functions can create powerful and dynamic formulas that help you manage and analyze data more effectively. This section will guide you on how to use INDEX with some commonly used Google Sheets functions.

### With VLOOKUP

Usage: The VLOOKUP function is used to search for a value in the first column of a range and return a value in the same row from a specified column. When combined with INDEX, it can be used to return a value from the same row in a different range.

Example: Let’s say you have a list of employees in column A, their departments in column B, and their salaries in column C. You want to find out the salary of an employee whose name you have in cell E1.

Here’s the formula you can use:

=VLOOKUP(E1, A2:C100, 3, FALSE)

The above formula will search for the employee name in cell E1 in the range of A2 to C100 and return the salary from column 3.

### With MATCH

Usage: MATCH function is used to return the relative position of an item in a range that matches a specified value. When used with INDEX, it can return a value from a specified position in a range.

Example: In the same employee list, if you want to find out the department of the 5th employee in the list, you can use the MATCH function with INDEX.

Here’s the formula you can use:

=INDEX(B2:B100, MATCH(“5”, A2:A100, 0))

This formula will return the department of the 5th employee in the list.

### With COUNTIF

Usage: COUNTIF function counts the number of cells in a range that meet a specified condition. When used with INDEX, it can return a value from the cell in the position that corresponds to the count.

Example: If you want to find out the salary of the employee who is the 10th one from the ‘Marketing’ department, you can use the COUNTIF function with INDEX.

Here’s the formula you can use:

=INDEX(C2:C100, COUNTIF(B2:B100, “Marketing”))

This formula will return the salary of the 10th employee from the ‘Marketing’ department.

For more details on the INDEX function, check out the official documentation at the Google Docs Editors Help Center. 