INDEX function
Returns the value at a given row and column position inside a range, or a whole row or column of it.
Available in All versions of Excel, including Microsoft 365, Excel for the web and Excel for Mac
In every Excel versionWorks in Google Sheets
Syntax
INDEX(array, row_num, [column_num], [area_num])| Argument | What it means | |
|---|---|---|
array | Required | The range or array to pick from. It can also be several ranges in brackets, e.g. (A2:C5, E2:G5). |
row_num | Required | The row position inside array (1 = first row). Use 0 to return the entire column. |
column_num | Optional | The column position inside array. Use 0 to return the entire row. Can be left out for a single-column range. |
area_num | Optional | When array lists several ranges, which one to use (1 = first). Default 1. |
Returns: The value (actually a reference) at the intersection of row_num and column_num, or a whole row/column when one of them is 0.
How INDEX works
INDEX answers the question "what is in row x, column y of this table?". On its own it is simple: =INDEX(B2:B5, 3) gives you the third item of the list. Its real power appears when another function supplies the position - most famously MATCH, which finds where a value sits. INDEX + MATCH was the go-to flexible lookup for decades because, unlike VLOOKUP, it can return from any column, including ones to the left.
Positions are always counted from the top-left of the range you give, not from row 1 of the sheet. If you set row_num to 0 INDEX returns the whole column, and if you set column_num to 0 it returns the whole row; in Microsoft 365 those results spill. Because INDEX returns a reference rather than just a value, it can also form one end of a range, as in SUM(B2:INDEX(B2:B13, 6)), which sums January to June.
INDEX is non-volatile, so it is a faster and safer choice than OFFSET or INDIRECT for building dynamic ranges.
Examples
1Pick the 3rd item from a list
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Code | Product | Price | ||
| 2 | P-101 | Keyboard | 25 | Monitor | |
| 3 | P-102 | Mouse | 12 | ||
| 4 | P-103 | Monitor | 149 | ||
| 5 | P-104 | Webcam | 39 |
Result: Monitor
Position 3 of B2:B5 is cell B4.
2Row and column in a grid
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Region | Q1 | Q2 | Q3 | Q4 |
| 2 | North | 12500 | 14200 | 13900 | 16100 |
| 3 | South | 9800 | 10400 | 11250 | 12030 |
| 4 | East | 7600 | 8150 | 8900 | 9420 |
| 5 | |||||
| 6 | 11250 |
Result: 11250
Inside B2:E4, row 2 is South and column 3 is Q3, so INDEX returns cell D3.
3INDEX + MATCH lookup
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Code | Product | Price | ||
| 2 | P-101 | Keyboard | 25 | 39 | |
| 3 | P-102 | Mouse | 12 | ||
| 4 | P-103 | Monitor | 149 | ||
| 5 | P-104 | Webcam | 39 |
Result: 39
MATCH finds Webcam at position 4 of B2:B5, and INDEX returns position 4 of C2:C5. Insert columns between B and C and the formula still works.
4Return a whole row
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Code | Product | Price | ||||
| 2 | P-101 | Keyboard | 25 | P-102 | Mouse | 12 | |
| 3 | P-102 | Mouse | 12 | ||||
| 4 | P-103 | Monitor | 149 | ||||
| 5 | P-104 | Webcam | 39 |
A column number of 0 asks for every column of row 2, so the record for the mouse spills into E2:G2.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#REF! | row_num or column_num points outside the range, e.g. row 6 of a 4-row range. | Check the positions, or wrap the formula in IFERROR. |
#N/A | The nested MATCH did not find its value. | Fix the lookup value or use MATCH with 0 for an exact match. |
#VALUE! | A position is text or a negative number. | Make sure positions are whole numbers of 1 or more (or 0 for an entire row/column). |
Tips
- Count positions from the start of the range, not from the sheet:
INDEX(B5:B9, 1)returns B5. - Two-way lookup:
=INDEX(B2:E4, MATCH("South", A2:A4, 0), MATCH("Q3", B1:E1, 0)). =SUM(B2:INDEX(B2:B13, E1))builds a year-to-date total for the number of months typed in E1 without volatile functions.
Questions
Is INDEX MATCH still worth learning?
Yes. It works in every Excel version, handles left lookups and two-way lookups, and appears in countless existing workbooks.
What does INDEX return with a row number of 0?
The whole column of the range (and a column number of 0 returns the whole row). In Microsoft 365 the result spills into neighbouring cells.
Google Sheets
INDEX also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
INDEX in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | INDEKS |
| Finnish | INDEKSI |
| Italian | INDICE |
| Norwegian (Bokmål) | INDEKS |
| Polish | INDEKS |
| Portuguese (Brazil) | ÍNDICE |
| Portuguese (Portugal) | ÍNDICE |
| Russian | ИНДЕКС |
| Spanish | INDICE |
| Turkish | İNDİS |
Recipes that use INDEX
- How to calculate a running total in Excel
- How to create a dynamic named range in Excel
- How to do a case-sensitive lookup in Excel
- How to find the last value in a column in Excel
- How to get the nth match in Excel
- How to list the top 5 values with names in Excel
- How to look up a value to the left in Excel
- How to look up a value with two criteria in Excel