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 and MATCH


Share

INDEX and MATCH

INDEX and MATCH means using two functions together to look up a value in a table. It works like VLOOKUP, but it can look in any direction.

MATCH finds the position of the search value. INDEX returns the value at that position from another column.

The combined formula looks like this:

=INDEX(return_range, MATCH(lookup_value, lookup_range, 0))

These names are only labels to explain the formula:

Return_range: The column with the value you want to get back.

Lookup_value: The value to search for. This is usually the cell where the search value is entered.

Lookup_range: The column to search in.

0: Exact match. Always type it. Without it, MATCH uses approximate match.

Note: The lookup_range and the return_range must start and end on the same rows, like B2:B21 and E2:E21. Otherwise the position from MATCH points to the wrong row.

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

The symbol depends on your Language Settings.

How to use INDEX and MATCH:

  1. Select a cell (H4)
  2. Type =INDEX
  3. Double click the INDEX command
  4. Mark the range to return a value from (E2:E21)
  5. Type (,)
  6. Type MATCH
  7. Double click the MATCH command
  8. Select the cell where the search value will be entered (H3)
  9. Type (,)
  10. Mark the range to search in (B2:B21)
  11. Type (,)
  12. Type 0 for an exact match
  13. Type two closing parentheses ()))
  14. Hit enter
  15. Enter a value in the search cell (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 Search Name in G3 and Total in G4.

Use INDEX and MATCH to find the Total of a Pokemon based on its Name. Type Charizard in H3:

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

Excel works from the inside out:

  1. MATCH(H3, B2:B21, 0) finds Charizard at position 6 in B2:B21.
  2. INDEX(E2:E21, 6) returns the 6th value in E2:E21, which is 534.


Look to the Left

VLOOKUP can only return values from columns to the right of the search column. With INDEX and MATCH, the return column can be anywhere, also to the left.

Find the ID# of a Pokemon based on its Name. Change the label in G4 to ID#, and type Butterfree in H3:

GH
3Search NameButterfree
4ID#12
=INDEX(A2:A21, MATCH(H3, B2:B21, 0))

MATCH finds Butterfree in B13, and INDEX returns the value from the same row in A2:A21, which is 12.


Two-Way Lookup

INDEX can take both a row number and a column number. Use one MATCH for each, and you can pick the column by its header name.

Change the label in G4 to Search Column, and type Result in G5. Type Pidgeot in H3, Total in H4, and the formula in H5:

GH
3Search NamePidgeot
4Search ColumnTotal
5Result479
=INDEX(A2:E21, MATCH(H3, B2:B21, 0), MATCH(H4, A1:E1, 0))
  1. MATCH(H3, B2:B21, 0) finds Pidgeot at position 18.
  2. MATCH(H4, A1:E1, 0) finds Total at position 5.
  3. INDEX(A2:E21, 18, 5) returns the value in row 18, column 5 of the table, which is 479.

Change H4 to Type 1, and the result changes to Normal.

Note: The ranges must line up. B2:B21 starts on the same row as A2:E21, and A1:E1 starts in the same column. That way the positions from MATCH point to the right row and column.


Why Use INDEX and MATCH?

  • It works in every version of Excel. XLOOKUP is not available in Excel 2019 or earlier.
  • It can look to the left.
  • It uses ranges, not column numbers, so inserting a column in the table does not break it.
  • It can do two-way lookups.

If you have Excel for Microsoft 365, Excel 2021 or Excel 2024, XLOOKUP does the same with a shorter formula.


VLOOKUP vs INDEX and MATCH vs XLOOKUP

VLOOKUPINDEX and MATCHXLOOKUP
Excel versionsAll versionsAll versionsMicrosoft 365, Excel 2021, Excel 2024 and Excel for the web
Look to the leftNoYesYes
Exact matchType FALSE or 0Type 0 in MATCHThe default
The return column is set byA column numberA rangeA range
Inserting a column in the tableCan break the resultAdjusts automaticallyAdjusts automatically
Own message when nothing is foundNoNoYes, with if_not_found
Functions in the formulaOneTwoOne

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.