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


Share

MATCH Function

The MATCH function is a premade function in Excel, which searches for a value in a range and returns its position.

MATCH returns the position, not the value. If the value is in the 7th cell of the range, MATCH returns 7.

It is typed =MATCH and has the following parts:

=MATCH(lookup_value, lookup_array, [match_type])

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

The symbol depends on your Language Settings.

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

Lookup_array: The range to search in. It must be a single column or a single row.

Match_type: Optional. How the lookup_value is matched:

Match_typeDescription
0Exact match. The data can be in any order.
1The largest value that is less than or equal to lookup_value. The data must be sorted in ascending order (smallest to largest). This is the default if you leave match_type out.
-1The smallest value that is greater than or equal to lookup_value. The data must be sorted in descending order (largest to smallest).

Note: Always type 0 for an exact match. If you leave match_type out, Excel uses 1. On data that is not sorted, like the names in the example below, 1 can return a wrong position without any error.

How to use the MATCH function:

  1. Select a cell (H4)
  2. Type =MATCH
  3. Double click the MATCH command
  4. Select the cell where the search value will be entered (H3)
  5. Type (,)
  6. Mark the range to search in (B2:B21)
  7. Type (,)
  8. Type 0 for an exact match
  9. Hit enter
  10. 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 Position in G4.

Use the MATCH function to find the position of a Pokemon in the Name column. Type Squirtle in H3:

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

Squirtle is in B8. That is the 7th cell of B2:B21, so MATCH returns 7, not 8.

You can also type the value straight into the formula. Text must be inside double quotes: =MATCH("Squirtle", B2:B21, 0) also returns 7.



MATCH is Not Case-Sensitive

MATCH does not see a difference between uppercase and lowercase letters. Type squirtle in lowercase in H3:

GH
3Search Namesquirtle
4Position7

MATCH still returns 7.


When There is No Match

If MATCH does not find the value, it returns #N/A. Pikachu is not in the table:

GH
3Search NamePikachu
4Position#N/A

MATCH in a Row

The lookup_array can also be a row. Find the position of the Total header in the header row A1:E1.

Change the label in G3 to Search Header, and type Total in H3:

GH
3Search HeaderTotal
4Position5
=MATCH(H3, A1:E1, 0)

Total is the 5th cell in A1:E1, so MATCH returns 5.


MATCH With INDEX

A position on its own is often not what you need. Combine MATCH with the INDEX function, which returns the value at a position:

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

With Squirtle in H3, MATCH returns 7, and INDEX returns the 7th value in E2:E21, which is 314.

This is a lookup that works in every version of Excel. 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.