Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING HTML & CSS BASH RUST TOOLS

Excel Tutorial

Excel HOME Excel Introduction Excel Get Started Excel Overview Excel Syntax Excel Ranges Excel Fill Excel Move Cells Excel Add Cells Excel Delete Cells Excel Undo Redo Excel Formulas Excel Relative Reference Excel Absolute Reference Excel Arithmetic Operators Excel Parentheses Excel Functions

Excel Formatting

Excel Formatting Excel Format Painter Excel Format Colors Excel Format Fonts Excel Format Borders Excel Format Numbers Excel Format Grids Excel Format Settings

Excel Data Analysis

Excel Sort Excel Filter Excel Tables Excel Conditional Format Excel Highlight Cell Rules Excel Top Bottom Rules Excel Data Bars Excel Color Scales Excel Icon Sets Excel Manage Rules (CF) Excel Charts

Excel PivotTables

Excel PivotTable Intro Excel Create PivotTable Excel PivotTable Values Excel PivotTable Filter Excel PivotTable Group Excel Calculated Field Excel PivotChart

Excel Case

Case: Poke Mart Case: Poke Mart, Styling

Excel Functions

AND AVERAGE AVERAGEIF AVERAGEIFS CONCAT COUNT COUNTA COUNTBLANK COUNTIF COUNTIFS DATEDIF FILTER HLOOKUP IF IFERROR IFS INDEX INDEX MATCH LEFT LEN LOWER MATCH MAX MEDIAN MID MIN MODE NETWORKDAYS NPV OR PROPER RAND RIGHT ROUND SORT STDEV.P STDEV.S SUBSTITUTE SUM SUMIF SUMIFS SUMPRODUCT TEXTJOIN TODAY TRIM UNIQUE UPPER VLOOKUP XLOOKUP XOR

Excel How To

Convert Time to Seconds Difference Between Times NPV (Net Present Value) Remove Duplicates

Excel Cert

Excel Certificate

Excel Examples

Excel Exercises Excel Syllabus Excel Study Plan Excel Training

Excel References

Excel Keyboard Shortcuts


Excel INDEX Function


Share

INDEX Function

The INDEX function is a premade function in Excel, which returns the value at a given position in a range.

You give it a range and a row number, and if needed a column number. INDEX returns the value in that cell.

It is typed =INDEX and has the following parts:

=INDEX(array, row_num, [column_num])

Note: The different parts of the function are separated by a symbol, like comma , or semicolon ;

The symbol depends on your Language Settings.

Array: The range to return a value from.

Row_num: The row in the range, counted from the top of the range.

Column_num: Optional. The column in the range, counted from the left of the range. You can leave it out when the range is a single column.

Note: Positions count from the top-left cell of the range you give, not from the top of the sheet. Row 1 of B2:B21 is sheet row 2.

INDEX also has a second form with a fourth part, area_num, for picking from several ranges. This page covers the common form shown above.

How to use the INDEX function:

  1. Select a cell (H4)
  2. Type =INDEX
  3. Double click the INDEX command
  4. Mark the range (B2:B21)
  5. Type (,)
  6. Select the cell where the row number will be entered (H3)
  7. Hit enter
  8. Enter a number in H3

Let's have a look at an example!

This is the same Pokemon table as on the VLOOKUP page. Copy it and paste it into cell A1 to follow along:

Example data

ABCDE
1ID#NameType 1Type 2Total
21BulbasaurGrassPoison318
32IvysaurGrassPoison405
43VenusaurGrassPoison525
54CharmanderFire309
65CharmeleonFire405
76CharizardFireFlying534
87SquirtleWater314
98WartortleWater405
109BlastoiseWater530
1110CaterpieBug195
1211MetapodBug205
1312ButterfreeBugFlying395
1413WeedleBugPoison195
1514KakunaBugPoison205
1615BeedrillBugPoison395
1716PidgeyNormalFlying251
1817PidgeottoNormalFlying349
1918PidgeotNormalFlying479
2019RattataNormal253
2120RaticateNormal413

Type the labels Row in G3 and Name in G4.

Use the INDEX function to return the 7th name in the list. Type 7 in H3:

ABCDEFGH
1ID#NameType 1Type 2Total
21BulbasaurGrassPoison318
32IvysaurGrassPoison405Row7
43VenusaurGrassPoison525NameSquirtle
54CharmanderFire309
65CharmeleonFire405
76CharizardFireFlying534
87SquirtleWater314
98WartortleWater405
109BlastoiseWater530
1110CaterpieBug195
1211MetapodBug205
1312ButterfreeBugFlying395
1413WeedleBugPoison195
1514KakunaBugPoison205
1615BeedrillBugPoison395
1716PidgeyNormalFlying251
1817PidgeottoNormalFlying349
1918PidgeotNormalFlying479
2019RattataNormal253
2120RaticateNormal413
=INDEX(B2:B21, H3)

INDEX counts 7 rows down from the top of B2:B21. The 7th cell is B8, which holds Squirtle.

You can also type the number straight into the formula. =INDEX(B2:B21, 7) returns Squirtle as well.



Row and Column

When the range has several columns, add a column number. INDEX returns the value where the row and the column meet.

Change the label in G4 to Column, and type Value in G5. Type 6 in H3, 5 in H4, and the formula in H5:

GH
3Row6
4Column5
5Value534
=INDEX(A2:E21, H3, H4)

Row 6 of A2:E21 is the row for Charizard (sheet row 7). Column 5 is Total (column E). So INDEX returns 534 from E7.

With the numbers typed in, the formula is =INDEX(A2:E21, 6, 5). It returns 534 as well.


Positions Count From the Range

INDEX counts from the first cell of the range you give it. That means the same cell can have different positions in different ranges:

FormulaResultCell
=INDEX(B2:B21, 7)SquirtleB8
=INDEX(B8:B21, 1)SquirtleB8
=INDEX(B1:B21, 7)CharizardB7
=INDEX(A2:E21, 6, 5)534E7
=INDEX(C2:E21, 6, 3)534E7

Look at B1:B21. It starts at the header row, so row 7 of this range is sheet row 7, which holds Charizard, not Squirtle.

Tip: Check where your range starts. Adding or leaving out the header row changes every position by one.


Position Outside the Range

If the row number or column number is larger than the range, INDEX returns the #REF! error.

B2:B21 has 20 rows, so this formula returns #REF!:

=INDEX(B2:B21, 21)

INDEX With MATCH

INDEX needs a position. Often you do not know the position, only the value, like the name of a Pokemon.

The MATCH function finds the position for you:

=INDEX(E2:E21, MATCH("Squirtle", B2:B21, 0))

MATCH returns 7, the position of Squirtle in B2:B21. INDEX then returns the 7th value in E2:E21, which is 314.

Learn more in the INDEX and MATCH chapter.


Free account

Track your progress

XP earned 0 Day streak 0 Spaces 0 League —

New

Learn in Adventure Mode W3Schools Adventure App

Coding fundamentals as bite-sized lessons and challenges.

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.