The INDEX function is one of the most versatile and powerful lookup functions in Excel. It allows you to retrieve data from a specific cell or range of cells based on a row and column number or reference. While it may seem complicated at first, the INDEX function is easy to use once you understand the basics. In this article, I’ll walk you through everything you need to know to become an INDEX formula pro in Excel.
What is the INDEX Function?
The INDEX function returns a value or reference from within a table or range, There are two forms of the INDEX function
- Array form – Returns a value
- Reference form – Returns a cell reference
The array form is useful when you want to look up a value based on a row and column number. The reference form is handy when you want to return an actual cell reference.
I find myself using the array form of INDEX most often to look up and return values But both forms are very powerful and have multiple applications
INDEX Function Syntax
The syntax or formula structure for the two forms of the INDEX function are:
Array form:
=INDEX(array, row_num, [col_num])
Reference form:
=INDEX(reference, row_num, [col_num], [area_num])
Here is a quick overview of what each argument means:
- Array – The table or range of cells to lookup in
- Reference – One or more cell ranges
- Row_num – The row number to return
- Col_num – Optional; the column number to return
- Area_num – Optional; used to select a range when reference includes multiple ranges
The key things to notice are:
- The row_num is required; the col_num is optional
- Reference form has an optional 4th argument to specify an area or range
Now let’s look at each form of the INDEX function in more detail.
Using the Array Form of INDEX
The array form of INDEX is great when you want to return a value based on a row and column number or position.
For example, let’s say you have a simple data set like this:
Fruit | Count | Price |
---|---|---|
Apples | 63 | $0.99 |
Oranges | 29 | $0.69 |
Bananas | 48 | $0.39 |
To look up the count for Oranges, you can use this formula:
=INDEX(B2:D4, 2, 1)
This returns 29, the count for oranges in row 2, column 1.
The array form of INDEX is useful in formulas where you are frequently looking up values by row and column position. For example, you may use it together with the MATCH function to perform lookups.
Here are a few things to keep in mind when using the array form of INDEX:
- The array can be a range reference like A1:C10 or a named range
- Use row_num to specify the row, and col_num for the column
- Col_num is optional if your array only has one column
- Returns the #REF error if row/column is outside the array range
You can also use row_num and col_num set to 0 to return entire rows or columns:
=INDEX(A:C,0,2) // returns the entire column C =INDEX(A:C,3,0) // returns the entire row 3
This can be useful for returning arrays to populate dynamic ranges with a single formula.
Using the Reference Form of INDEX
The reference form of INDEX comes in handy when you want to return an actual cell reference instead of just the value.
The key difference between the array and reference forms is:
- Array form returns a value
- Reference form returns a cell reference
For example, let’s say you have a data range like this:
Date | Amount |
---|---|
1/1/2020 | $100 |
1/15/2020 | $250 |
You need a formula to reference the cell in column B on row 2 dynamically.
Here is how you can use the reference form of INDEX:
=INDEX(B2:B3,2,1)
This returns a reference to cell B2.
This may not seem useful when you can already reference B2 directly. But it comes in handy in more complex formulas where you need to output a dynamic reference based on changing criteria.
The reference form of INDEX also has a 4th area_num argument to specify a range/area within a multi-area reference.
For example:
=INDEX((B2:B3,D2:D3),1,1,2)
This returns a reference to D2, by looking in the 2nd area (D2:D3).
The reference form can be useful when creating dynamic named ranges and formulas where you need cell references instead of just values.
Lookup Entire Rows or Columns with INDEX
One handy trick with INDEX is that you can look up entire rows and columns easily.
To return an entire column, use 0 for the row_num:
=INDEX(A:C,0,2)
For an entire row, use 0 for the col_num:
=INDEX(A:C,3,0)
This makes it easy to create dynamic ranges and spilled arrays based on row and column criteria.
For example, you could build a formula to return an entire row of data based on a lookup value, using INDEX and MATCH:
=INDEX(A:E,MATCH(lookup_value,A:A,0),0)
Looking Up with INDEX and MATCH
INDEX and MATCH are often used together to perform advanced lookups in Excel.
The MATCH function finds the position of an item in a range and feeds that position to INDEX to return the corresponding value.
Here is a basic example to look up an employee name based on ID:
ID | Name |
---|---|
212 | John Smith |
324 | Jane Doe |
Formula to lookup name for ID 324:
=INDEX(B2:B3,MATCH(324,A2:A3,0))
MATCH finds the position of 324 in A2:A3 (row 2) and passes it to INDEX to return Jane Doe.
This is much more flexible than the basic VLOOKUP function and allows lookups to the left, lookups with multiple criteria, and more.
Creative Uses for the INDEX Function
Since INDEX returns cell references and arrays, you can use it in creative ways to build dynamic formulas.
Here are a few examples of what you can do:
- Create expanding or contract ranges based on criteria
- Build dynamic charts where the source data changes
- Variable drop-downs for data validation
- Audit formulas with wildcard matching
- Dynamic named ranges that auto-expand
Don’t be afraid to experiment. The key is understanding that INDEX can return entire rows, columns, and arrays. This unlocks many possibilities.
INDEX Formula Examples
Here are a few examples of INDEX formulas to demonstrate some real-world uses:
Vlookup with INDEX/MATCH
=INDEX(B2:B11,MATCH(D2,A2:A11,0)) // Lookup employee name by ID
Lookup with multiple criteria
=INDEX(C2:C11,MATCH(1,(A2:A11=D2)*(B2:B11=E2),0)) // Lookup price by product and size
Create a dynamic named range
=INDEX(Data!B2:B1000,COUNT(Data!B2:B1000)) // Named range expands as rows added
Return array for chart source data
=INDEX(SalesData!$B$2:$D$1000,,MATCH(B$1,SalesData!$B$1:$D$1,0)) // Chart source updates when you change column
Top Tips for Using INDEX Effectively
Here are some top tips to help you master the INDEX function:
- Start simple and build up more complex INDEX formulas once you get the basics down
- Use named ranges and table references to make formulas easier to read
- Learn how to combine INDEX with MATCH, OFFSET, COUNTA, and other functions
- Understand the difference between array form and reference form and when to use each
- Take advantage of returning full rows, columns, and arrays with INDEX
- Use INDEX to create dynamic ranges that auto-expand as you add data
- Avoid whole column references in arrays – use ranges like A:A instead of just A
- Test formulas thoroughly with different input scenarios to catch errors
With a bit of practice, INDEX can become one of your favorite Excel functions for advanced lookups and dynamic ranges.
#3 How to Combine INDEX and MATCH
Now we can take the two MATCH formulas and use them to replace the “4” and the “2” in the original INDEX formula. The result is an INDEX MATCH formula.
Follow these steps:
- Cut the MATCH formula for Kevin and replace the “4” with it.
- Cut the MATCH formula for Height and replace the “2” with it.
- The result is Kevin’s Height is “5.8.”
- Congratulations, you now have a dynamic INDEX MATCH formula!
#1 How to Use the INDEX Formula
Below is a table showing people’s names, height, and weight. We want to use the INDEX formula to look up Kevin’s height… here is an example of how to do it.
Follow these steps:
- Type “=INDEX(” and select the area of the table, then add a comma
- Type the row number for Kevin, which is “4,” and add a comma
- Type the column number for Height, which is “2,” and close the bracket
- The result is “5.8.”
How to use the INDEX function in Excel
How to use index function in Excel?
There are two ways to use the INDEX function: If you want to return the value of a specified cell or array of cells, see Array form. If you want to return a reference to specified cells, see Reference form. Returns the value of an element in a table or an array, selected by the row and column number indexes.
What is the syntax of index function in Excel?
The Excel INDEX function has two versions of its syntax. These are referred to as the array form and the reference form. Let’s first discuss the reference argument of the formula. Its syntax is: =INDEX (reference, =INDEX (reference, row_num, [columm_num], [area_num])
How to use index function in JavaScript?
There are two formats for the INDEX function: The array format is used when we wish to return the value of a specified cell or array of cells. =INDEX (array, row_num, [col_num]) The function uses the following arguments: Array (required argument) – This is the specified array or range of cells.
How to use index function in financial analysis?
In financial analysis, we can use it along with other functions, for lookup and to return the sum of a column. There are two formats for the INDEX function: The array format is used when we wish to return the value of a specified cell or array of cells. =INDEX (array, row_num, [col_num]) The function uses the following arguments: