fxExcelReps
PRO

You've used your 3 free functions

To practise INDEX and every other function, get a PRO subscription.

  • Unlimited access to every function
  • New functions and exercises every month
  • Every mistake explained + full solutions

Your free functions — you can always come back to these:

← All functions

How to use INDEX in Excel

INDEX returns the value at a given row (and column) of a range. Combined with MATCH — INDEX/MATCH — it's a lookup that works in any direction, in any Excel version, and survives inserted columns.

Syntax

=INDEX(array, row_num, [column_num])

arrayThe range to take a value from.
row_numWhich row of the range.
[column_num]Which column (for ranges with more than one column).

Examples

=INDEX(C2:C100, 5)The 5th value in C2:C100.
=INDEX(A2:D100, 3, 2)Row 3, column 2 of the table.
=INDEX(C2:C100, MATCH(E2, A2:A100, 0))Price for the code in E2.
=INDEX(B2:M50, MATCH(G2, A2:A50, 0), MATCH(H2, B1:M1, 0))Two-way lookup: row by name, column by month.

INDEX/MATCH step by step

Read it from the inside out. MATCH(E2, A2:A100, 0) finds the position of E2 in the list, say the 7th row. INDEX(C2:C100, 7) then returns the 7th value of the result column. The 0 in MATCH means exact match, the same job FALSE does in VLOOKUP.

=MATCH(E2, A2:A100, 0)The position of E2 in the list, for example 7.
=INDEX(C2:C100, MATCH(E2, A2:A100, 0))The value from column C at that position.

Look to the left

The search column and the result column are separate, so the result can be on either side.

=INDEX(A2:A100, MATCH(E2, C2:C100, 0))The code in column A for the name in E2, searched in column C.

Two-way lookup: a row and a column

Use two MATCHes, one for the row and one for the column, to pull a value out of the middle of a table, like the sales of one product in one month.

=INDEX($B$2:$M$50, MATCH($G2, $A$2:$A$50, 0), MATCH(H$1, $B$1:$M$1, 0))Product from column G, month from row 1: copy it across and down for a whole report.

INDEX/MATCH with two conditions

Multiply two tests inside MATCH to find the row where both are true. In Excel 365 it works like a normal formula; in older versions confirm it with Ctrl+Shift+Enter.

=INDEX(D2:D100, MATCH(1, (A2:A100=F2)*(B2:B100=G2), 0))The price of the product in F2 in the size in G2.

Common mistakes

#REF! error
The row or column number is outside the range.
Ranges of different heights
In INDEX/MATCH, the INDEX range and the MATCH range must start and end on the same rows.

Frequently asked questions

Why use INDEX/MATCH instead of VLOOKUP?

It can look left, it doesn't break when you insert or delete columns, and on big files it's faster because it reads only the two columns it needs.

What does the 0 in MATCH mean?

Exact match. 1 (the default) finds the largest value that's less than or equal to the one you look for and needs a list sorted from smallest to largest. -1 finds the smallest value that's greater than or equal and needs a list sorted from largest to smallest.

Why does INDEX/MATCH return #N/A?

MATCH can't find the value. Check for extra spaces, numbers stored as text and a missing 0 at the end of MATCH.

INDEX/MATCH or XLOOKUP?

In Microsoft 365, XLOOKUP is simpler to write. INDEX/MATCH works in every version of Excel, so it's the safe choice for files you send to other people.

Available in: All versions of Excel, Excel for the web, Google Sheets

Related functions

MATCHXLOOKUPVLOOKUP