Skip to content

All-Access: every lesson, no ads. $8.25€8.25US$8.25$4.08US$4.08$2.41US$2.41₹224.91MX$74.91 a month, billed yearly. Free to start. Cancel any time

See plans
All-Access, no ads: every lesson, course and template. $8.25€8.25US$8.25$4.08US$4.08$2.41US$2.41₹224.91MX$74.91 a month. + GST at checkoutSee the plans →

Functions

INDEX Function in Excel: Syntax, Examples and Fixes

By the LogicExcel Editorial Team16 min read3,099 wordsPractice this

INDEX returns the value at a row and column position inside a range. To get the price for the third carrier in the second region, type =INDEX(B2:D5,3,2). Excel counts down 3 rows and across 2 columns inside B2:D5 and returns 105. Set the row or column to 0 to return a whole column or row, and pair INDEX with MATCH when you want to find the position by name.

Try this now

The INDEX function returns a value at a specific column and row within a range. Get "Berlin" from the range A1:B4: it is in the third row and the second column.
ABCD
1AustraliaSydney
2FranceParis
3GermanyBerlin
4ThailandBangkok
5
6
D6fx

You are typing into D6. Refer to the cells that hold the data.

Continue the full lesson →

Ready to practice?

Apply what you just learned with interactive exercises.

Start Lesson 14

This guide covers the INDEX function in Excel from the first formula to the parts most pages skip: the two forms of the function, returning a full row or column, using INDEX to build ranges that grow, and the reason it can sit on either side of a colon. The INDEX MATCH lookup has its own page, so one section here covers it briefly and links out.

TL;DR

  • The pattern is =INDEX(array, row_num, [column_num]). Position comes from the top left cell of the range you give it, not from the sheet.
  • Row first, column second. Swapping them is a common mistake and gives #REF! or the wrong cell.
  • For a single column or single row, give one number: =INDEX(A2:A5,4).
  • A row or column number of 0 returns the whole column or row, which SUM, AVERAGE and MAX accept.
  • INDEX returns a reference, so =SUM(B2:INDEX(B2:B5,3)) builds a range that stretches or shrinks.
  • INDEX works in every Excel version. For lookups by name, combine it with MATCH.

Table of Contents

The sample data used in every example

You run an online shop and compare what four couriers charge per parcel. The prices, in rand, sit in a grid. Type it into a blank sheet starting at A1.

RowABCD
1CarrierGautengWestern CapeKwaZulu-Natal
2Blue Fleet85140120
3Karoo Express70125110
4Harbour Freight9510590
5Metro Courier60130115
Four input cells sit to the right. G2 and H2 hold row and column numbers, and J2 holds a region name.
RowGHJ
1Row #Column #Region
232Gauteng
There are four carriers in A2:A5 and three regions in B1:D1. The price grid itself is B2:D5, and that is the range most formulas use.

INDEX function syntax and arguments

The INDEX formula in Excel comes in two forms. The one you will use almost every time is the array form.

=INDEX(array, row_num, [column_num])

ArgumentRequiredWhat it does
arrayYesThe range to pick from.
row_numYes, in most casesThe row position inside the array. 1 is the first row of the range. 0 means every row.
column_numNoThe column position inside the array. 1 is the first column of the range. 0 means every column.
Three details decide whether the INDEX function syntax gives you what you expect.
  1. Positions count from the top left of the array. In B2:D5, row 1 is sheet row 2. In B1:D5, row 1 is sheet row 1. The same position gives different cells when the range starts elsewhere.
  2. Row comes before column. =INDEX(B2:D5,3,2) is row 3, column 2. Reversed, =INDEX(B2:D5,2,3) is row 2, column 3, a different cell.
  3. With a single row or a single column you only need one number. For a range like A2:A5, =INDEX(A2:A5,4) returns the fourth item. The same holds for a one-row range such as B2:D2, where one number picks the item across.
The second form is the reference form, which accepts several ranges and an extra argument:

=INDEX(reference, row_num, [column_num], [area_num])

The reference is one range or a list of ranges in brackets, and area_num says which range of the list to use. It is rare in daily work and is covered in the examples.

INDEX examples from simple to advanced

Each INDEX example below uses the courier grid. These are the cases to learn before moving on to lookups.

How to get a value by row and column number

The basic INDEX formula picks one cell by position:

=INDEX(B2:D5,3,2)

Row 3 of the grid is Harbour Freight, column 2 is Western Cape, so the result is 105. If you are wondering how to use INDEX for the first time, this is the whole idea: you hand it a grid and two numbers.

When the positions come from cells, as they will once you build a form or a drop-down, the formula reads the numbers from G2 and H2:

=INDEX(B2:D5,G2,H2)

That also returns 105, and it changes as soon as you change G2 or H2.

How to use INDEX on a single column

For a list, give the range and one position. This is the example from the practice lessons in its simplest form.

=INDEX(A2:A5,4)

The fourth item in A2:A5 is Metro Courier. Now notice what happens when the range includes the header:

=INDEX(A1:A5,4)

This returns Harbour Freight, because row 1 of the new range is the header. Both formulas are correct. They count from different starting cells. When a position looks one off, check where the range starts.

How to return an entire row or column

A row number with a column number of 0 returns the whole row. A column number with a row number of 0 returns the whole column. Because the result is several cells, wrap it in a function that accepts them. To add up everything charged by Karoo Express:

=SUM(INDEX(B2:D5,2,0))

That is 70 plus 125 plus 110, or 305. To add up the KwaZulu-Natal column, use row 0 and column 3:

=SUM(INDEX(B2:D5,0,3))

That returns 435 (120, 110, 90 and 115). The same pattern works with other functions. The average of the Western Cape column is =AVERAGE(INDEX(B2:D5,0,2)), which returns 125, and the highest Gauteng price comes from =MAX(INDEX(B2:D5,0,1)), which is 95.

In Microsoft 365 and Excel 2021 or later you can also type =INDEX(B2:D5,2,0) on its own and the three values spill into three cells. Leaving off the column number does the same for a multi-column grid: =INDEX(B2:D5,3) returns all of row 3, which is 95, 105 and 90. In earlier versions a bare formula like this shows only the first value, so keep it inside SUM or similar for compatibility.

How to get the last value in a column

Count the filled cells and use that as the position:

=INDEX(B2:B5,COUNTA(B2:B5))

COUNTA returns 4, so INDEX returns the fourth Gauteng price, 60. When rows are added at the bottom, the position grows with them, as long as you point at a range that covers the new rows. Using a whole column works too:

=INDEX(A:A,COUNTA(A:A))

COUNTA counts the header as well, so it returns 5, and INDEX returns row 5 of the column, Metro Courier. This pattern breaks if the column has blank cells in the middle, because COUNTA only counts filled cells.

How to build a range that grows with INDEX

INDEX returns a reference to a cell, which means it can be used on either side of a colon to define a range. This adds up the Gauteng prices from the top down to the third carrier:

=SUM(B2:INDEX(B2:B5,3))

The range runs from B2 to wherever INDEX points, which is B4, so the total is 85 plus 70 plus 95, or 250. Change the 3 to a cell reference and the range stretches or shrinks. This is how people build charts and totals that follow a "last N rows" setting without volatile functions like OFFSET.

How to use the reference form with several ranges

Suppose the grid was split into two blocks, with Blue Fleet and Karoo Express in B2:D3 and the other two carriers in B4:D5. The reference form chooses a block with the fourth argument:

=INDEX((B2:D3,B4:D5),2,1,2)

Area 2 is B4:D5. Row 2, column 1 of that area is B5, so the result is 60. If you leave off the area number, Excel uses the first range. You rarely need this form, but it explains the extra argument in the syntax.

INDEX returns a reference, not just a value

Most functions hand back a value. INDEX hands back a cell, and Excel treats that cell like any other reference. That is why the colon trick above works and why INDEX can be passed to functions that expect a range.

A few other functions do the same. CHOOSE, OFFSET and IF can also return references. IF can return a range too, which trips up people who expect it to hand back only values. With the region name in J2:

=SUM(IF(J2="Gauteng",B2:B5,C2:C5))

When J2 says Gauteng, IF returns the range B2:B5 and SUM adds it up to 310. For any other region name it returns C2:C5 instead. The condition picks the range. Our OFFSET guide covers the volatile cousin, and the CHOOSECOLS guide shows a modern way to pick columns.

INDEX with MATCH for lookups

INDEX only needs a position. MATCH finds a position from a name. Together they form a lookup that can look left, survives inserted columns, and works in every Excel version.

=INDEX(D2:D5,MATCH("Harbour Freight",A2:A5,0))

MATCH returns 3, because Harbour Freight is third in A2:A5, and INDEX returns the third KwaZulu-Natal price, 90. For a two-way lookup, use MATCH for both numbers:

=INDEX(B2:D5,MATCH("Karoo Express",A2:A5,0),MATCH("Western Cape",B1:D1,0))

That returns 125. The full treatment, with more examples and the comparison against VLOOKUP, is on the INDEX MATCH guide. The MATCH guide explains the position-finding half on its own.

INDEX vs VLOOKUP, XLOOKUP, OFFSET and CHOOSE

QuestionINDEXVLOOKUP / XLOOKUPOFFSETCHOOSE
Needs a position or a keyA positionA keyA position and a shiftA position
Returns a referenceYesXLOOKUP onlyYesYes
Volatile (recalculates constantly)NoNoYesNo
Look leftYes, any columnXLOOKUP yes, VLOOKUP noYesNot applicable
Works in Excel 2019YesVLOOKUP yes, XLOOKUP noYesYes
Use INDEX when you already know the position, when you want a whole row or column to pass into SUM, or when you need a non-volatile range endpoint. Use XLOOKUP or VLOOKUP when you have a key and want a value. Use OFFSET only when you must, because it recalculates every time anything changes.

Which Excel versions have INDEX

INDEX is in every version of Excel, including Excel for Microsoft 365, Excel for the web and Excel for Mac, and has been for decades. Both forms work everywhere. The only difference by version is how a whole row or column is displayed: Microsoft 365 and Excel 2021 or later spill the values into neighbouring cells, while earlier versions need the formula wrapped in a function like SUM or entered as an array formula. Our dynamic arrays guide explains spilling.

INDEX errors and how to fix them

Each error below can be produced on the courier grid.

ErrorCauseFix
#REF!The row or column number is bigger than the range, as in =INDEX(B2:D5,5,1) or =INDEX(B2:D5,2,4).Count the rows and columns of the range and stay inside them.
#REF!A column number was given to a single-column range, as in =INDEX(A2:A5,4,2).Use one number for a one-column range.
#VALUE!The row or column number is negative, as in =INDEX(B2:D5,-1,1), or is text that is not a number.Use zero or a positive whole number.
#NAME?The function name is misspelled or text is not in quotes.Fix the spelling and quote the text.
A cell next to the one you wantedThe range starts higher or lower than you assumed, or row and column are swapped.Check where the range begins, then check the order.
Excel does not complain when a position points at the wrong place inside the range. If you enter 3 for the row and the range includes the header, you get the item above the one you expected. That is a wrong answer without an error, so a quick spot check against the grid is worth the five seconds.

What learners get wrong

Between 26 September and 3 November 2026, learners made 6,680 first attempts across our INDEX Function lesson, and 82.3% were right. INDEX Function Practice logged 2,820 first attempts with 85.5% right, and INDEX MATCH Lookup logged 3,258 with 75.7% right. A first attempt is the first check of a screen in a page view, not a head count of people. Four patterns stand out.

1. A column number given to a one-column range. The hardest screen in the first lesson asked for "Jacob" with the range B:B. Only 58.2% of 663 first attempts were right. The most common wrong answer, 150 times, was =index(b:b,4,2). The range B:B has one column, so a second number points at a column that does not exist and Excel returns #REF!. The correct form is =index(b:b,4). Others typed =index(b:b,2,4) (52 times), which swaps row and column.

2. Row and column swapped. On the screen asking for "Madison" in A1:B4, 74.2% of 643 first attempts were right. The most common wrong answer, 55 times, was =index(a1:b4,2,3), and =index(a1:b4,3,3) followed 34 times. The grid has two columns, so a column number of 3 is out of range. The target sits in row 3, column 2: =index(a1:b4,3,2). Say it aloud as "row, then column" before you press Enter. On the age screen, =index(a:b,2,1) was typed 25 times, which returns the name in column 1 where the age sits in column 2.

3. Leaving off the column number. =index(a1:b4,3) appeared 11 times on the Madison screen. On a grid with more than one column, one number returns the whole of row 3, not a single cell. Name the column, even when you think the answer is obvious.

4. Syntax slips and the lookup-style questions. On the Berlin screen, index(a1:b4,3,2) without the equals sign appeared 10 times, =index(a1;b4,3,2) with a semicolon instead of a colon 7 times, and a missing closing bracket 5 times. In the INDEX MATCH lesson, only 33.9% of 304 first attempts were right on the screen asking for the second argument, and some typed the whole formula or just delaware, where match("delaware",a:a,0) was wanted. On the screen where MATCH picks both row and column, 54.2% of 321 first attempts were right, and learners typed alaska 71 times, the state they were looking up, where the answer was its capital, Juneau.

A worked job: a rate card picker

Your sales team asks for a quick tool: pick a carrier and a region, see the price. Use the courier grid.

  1. Create two drop-downs. Put the carrier names from A2:A5 in a drop-down in G4 and the region names from B1:D1 in a drop-down in H4. The drop-down list guide shows the steps, and a drop-down stops most typos reaching the formula.
  2. Convert names to positions. In G5 write =MATCH(G4,A2:A5,0) and in H5 write =MATCH(H4,B1:D1,0). Pick Harbour Freight and Western Cape and you get 3 and 2.
  3. Return the price with INDEX. In G6 write =INDEX(B2:D5,G5,H5). With those picks the price is 105.
  4. Add a comparison. In G7 write =G6-AVERAGE(INDEX(B2:D5,0,H5)) to see how far that carrier sits above or below the regional average. The Western Cape average is 125, so the result is -20.
Splitting the lookup into MATCH cells and an INDEX cell lets you see each position. If a price looks wrong, the two position cells show which half is at fault.

Practice INDEX

Reading about positions will not make them automatic. The page already carries an exercise from Practice Lesson 14, so type the formula there rather than read on.

Then work through Practice Lesson 22, which gives more practice on the same patterns, and Practice Lesson 23, which adds MATCH so you can find the position by name. If you get one wrong, compare it with the four patterns above before you retry.

FAQ

What does the INDEX function do in Excel?

INDEX returns the value at a given position inside a range. You give it the range, a row number and optionally a column number, and it returns the cell at that position. For example, =INDEX(B2:D5,3,2) returns the cell in row 3, column 2 of the grid. It counts positions from the top left of the range.

What is the difference between INDEX and MATCH?

INDEX returns the item at a position. MATCH returns the position of an item. They do opposite jobs, which is why they are used together: MATCH turns a name into a position, and INDEX turns the position into a value. Alone, INDEX needs numbers from you, and MATCH on its own only gives you a number.

How do you return an entire row with INDEX?

Set the column number to 0, as in =INDEX(B2:D5,2,0). The result is every cell in row 2 of the range. In Microsoft 365 and Excel 2021 or later it spills across the sheet. In any version you can wrap it in SUM, AVERAGE or MAX, as in =SUM(INDEX(B2:D5,2,0)).

Why does INDEX return #REF!?

The row or column number is larger than the range, or you gave a column number to a range with only one column. =INDEX(B2:D5,5,1) fails because the range has four rows, and =INDEX(A2:A5,4,2) fails because it has one column. Count the rows and columns of your range and stay inside them.

Can INDEX look up values like VLOOKUP?

Not by itself, because it needs a position, not a key. Add MATCH to find the position and INDEX returns the value, for example =INDEX(D2:D5,MATCH("Harbour Freight",A2:A5,0)). The pair can also look to the left, which VLOOKUP cannot, and works in every Excel version. Our INDEX MATCH page covers it in detail.

Does INDEX work in all versions of Excel?

Yes. INDEX is available in every desktop version, Excel for Microsoft 365, Excel for the web and Excel for Mac. The difference is only how a whole row or column is shown: newer versions spill it into neighbouring cells, while older versions need it inside another function or entered as an array formula.

Sources

Keep going

Guides people read next.