Skip to content

INDEX

Returns the value at a given row and column of a range. Paired with MATCH, it is the classic lookup that works in every version of Excel.

Syntax

=INDEX(, , , )

Lookup and reference

Every version of Excel, including Microsoft 365, Excel 2024, 2021, 2019, 2016 and earlier, Excel for the web and the mobile apps.

Try it

Edit the formula in C8 or change the inputs. The sheet recalculates as you type.

C8
A
B
C
D
1
Month
Hours
Overtime
2
Jan
1240
86
3
Feb
1195
74
4
Mar
1310
112
5
Apr
1288
95
6
7
Row
Column
Value
8
3
2
1310
9

C8 =INDEX(A2:C5,A8,B8) returns 1310

How INDEX works

INDEX returns the value at a given position of a range: the third row, the second column. On its own that sounds trivial. Its real use is as the second half of a lookup, where MATCH works out the position and INDEX fetches the value.

The arguments

  • array is the range to read from.
  • row_num is the row inside that range, counted from 1. If the range is a single column, this is the only position you need.
  • column_num is the column inside the range. Leave it out for a single-column range. For a single-row range, skip row_num and give only the column, as in INDEX(B1:H1,,3).

Positions count inside the range, not on the sheet. INDEX(C5:C20,1) returns C5.

A row_num or column_num of 0 returns the whole column or row. In current Excel that result spills into the neighbouring cells, and it works inside functions such as SUM: =SUM(INDEX(B2:E9,0,3)) totals the third column.

INDEX/MATCH

=INDEX(C2:C9, MATCH(A12, A2:A9, 0)) finds A12 in A2:A9, then returns the item in the same position of C2:C9. Compared with VLOOKUP, this pairing:

  • can return a column to the left of the search column
  • doesn't count columns, so inserting or deleting a column won't break it
  • works in every version of Excel

The costs are length, and the fact that you must repeat the range sizes correctly: the INDEX range and the MATCH range must start on the same row. XLOOKUP does the same job in a single function and is easier to read, but it needs Excel 2021 or Microsoft 365. When a file must open in Excel 2019 or earlier, INDEX/MATCH is the safest choice.

For a two-way lookup, use two MATCH functions: =INDEX(B2:E9, MATCH(A12,A2:A9,0), MATCH(B12,B1:E1,0)).

INDEX returns a reference

INDEX doesn't just return a value. When it can, it returns a reference to the cell, which is why it can sit on either side of a colon: =SUM(B2:INDEX(B2:B20, 5)) adds B2 to B6. This is how you build a range that grows with the data without using the volatile OFFSET. INDEX isn't volatile, so it doesn't slow the workbook.

Errors

A row_num or column_num beyond the range returns #REF!. If MATCH inside INDEX returns #N/A, the whole formula returns #N/A. Wrap it in IFNA for a message.

Arguments

array
The range or array to read from, such as B2:D9. It can also be several ranges in brackets, such as (A1:B5,D1:E5), for the reference form.
row_num
The row to return, counted from the top of array. 0 returns the whole column. A number outside the range returns #REF!. For a one-column range you can use this argument alone.
column_numoptional
The column to return, counted from the left of array. 0 returns the whole row. For a one-row range you can leave row_num out and give only this one, as INDEX(B1:H1,,3).
area_numoptional
Which range to use when array is several ranges in brackets. The first range is 1. Rarely needed.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Read one cell by position

C8 =INDEX(A2:C5,A8,B8)

Result: 1310

The range A2:C5 has four rows and three columns. Row 3, column 2 is B4.

C8
A
B
C
D
1
Month
Hours
Overtime
2
Jan
1240
86
3
Feb
1195
74
4
Mar
1310
112
5
Apr
1288
95
6
7
Row
Column
Value
8
3
2
1310
9

C8 =INDEX(A2:C5,A8,B8) returns 1310

Example 2

INDEX with MATCH: look left

B8 =INDEX(A2:A5,MATCH(A8,B2:B5,0))

Result: INV-2043

MATCH finds Northgate Print in B2:B5 and returns 3. INDEX then returns the third item of A2:A5. The answer is to the left of the search column, which VLOOKUP can't do.

B8
A
B
C
D
1
Invoice
Customer
Amount
2
INV-2041
Harbour Foods
1850
3
INV-2042
Delta Tools
920
4
INV-2043
Northgate Print
2475
5
INV-2044
Harbour Foods
640
6
7
Customer
First invoice
8
Northgate Print
INV-2043
9

B8 =INDEX(A2:A5,MATCH(A8,B2:B5,0)) returns INV-2043

Example 3

Two-way lookup with two MATCH functions

C7 =INDEX(B2:E4,MATCH(A7,A2:A4,0),MATCH(B7,B1:E1,0))

Result: 40,800

The first MATCH finds Finance in the row labels and returns 3. The second finds Q2 in the headers and returns 2. INDEX returns row 3, column 2 of B2:E4.

C7
A
B
C
D
E
1
Cost centre
Q1
Q2
Q3
Q4
2
Facilities
62,000
58,500
60,200
71,400
3
IT
88,000
91,500
97,300
84,600
4
Finance
41,200
40,800
43,500
45,900
5
6
Cost centre
Quarter
Budget
7
Finance
Q2
40,800
8
9

C7 =INDEX(B2:E4,MATCH(A7,A2:A4,0),MATCH(B7,B1:E1,0)) returns 40,800

Example 4

Total a column chosen by a number

B7 =SUM(INDEX(B2:D4,0,A7))

Result: 233

A column_num of 0 means every row, so INDEX hands the whole third column, D2:D4, to SUM. Change A7 to total another month.

B7
A
B
C
D
E
1
Product
Jan
Feb
Mar
2
Gloves
120
96
140
3
Pallet wrap
38
31
24
4
Tape
75
82
69
5
6
Month number
Total
7
3
233
8

B7 =SUM(INDEX(B2:D4,0,A7)) returns 233

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 3

In B9, return the customer for the order in A9, using INDEX and MATCH.

Answer in B9.

B9
A
B
C
D
E
F
1
Order
Customer
Amount
Status
2
O-5501
Ridge Supply
4,200
Shipped
3
O-5502
Lakeside Cafe
1,350
Open
4
O-5503
Ridge Supply
2,980
Shipped
5
O-5504
Oakfield School
760
Open
6
O-5505
Lakeside Cafe
5,120
Cancelled
7
8
Order
Customer
Amount
9
O-5504
10
11
Customer
First order
12
Lakeside Cafe

Common mistakes

  • The INDEX range and the MATCH range must cover the same rows. INDEX(C2:C9, MATCH(A12, A3:A10, 0)) is off by one and returns the neighbouring item, with no error.
  • Forgetting the 0 in MATCH runs an approximate match, which needs sorted data and can return a wrong row silently. Always type 0 for an exact lookup.
  • Positions count inside the range you give, not from the top of the sheet. If you later insert a header row inside the range, every position shifts.
  • #REF! means the row or column number is larger than the range. #N/A from the MATCH means the lookup value wasn't found.
  • A row_num of 0 returns the whole column. If you meant "first row", use 1.

Questions people ask

What does INDEX do in Excel?

It returns the value at a given row and column inside a range. Most often it is paired with MATCH, which supplies the row number, to do lookups.

Is INDEX/MATCH better than VLOOKUP?

It is more flexible. It can look left, doesn't count columns, and keeps working when columns are inserted. It is longer to write, though, and VLOOKUP is easier for most people to read. Both work in every version of Excel.

Is INDEX/MATCH better than XLOOKUP?

Only for compatibility. XLOOKUP does the same job in one function, matches exactly by default and has a not-found argument. Use INDEX/MATCH when the file must open in Excel 2019 or earlier.

Is INDEX volatile?

No. INDEX recalculates only when its inputs change, unlike OFFSET and INDIRECT. That makes it the better choice for ranges that grow with the data.

How do I return a whole row or column with INDEX?

Set the other position to 0. `=INDEX(B2:E9,3,0)` returns the third row of the range, and `=INDEX(B2:E9,0,2)` returns the second column. In current Excel the result spills.

Learn INDEX in a real sheet.

INDEX is taught in Logic and text, lesson 14: TEXTSPLIT. Each lesson is a short, graded exercise like the one above.