ShareYourGroupShareYourGroupExcel Formulas

Guides

INDEX and MATCH together, step by step

INDEX and MATCH, used together, do everything VLOOKUP does and several things it cannot. The pair works in every version of Excel, which makes it the dependable choice for workbooks that many people open. It looks harder than it is. This page builds one slowly.

The sample

Sample sheet: A small price list with item codes. The table is sorted by code.
ABCDE
1CodeItemCategoryPriceStock
2A101Basmati Rice 5 kgGrocery65040
3A102Toor Dal 1 kgGrocery16075
4B201NotebookStationery60300
5B202Ball PenStationery100
6C301LED BulbElectronics110200
7C302Power BankElectronics129918
8D401Steel BottleHome45055

The task: given a code, find details of the item.

Step 1: MATCH finds the position

MATCH looks for a value in one row or column and says how far down it is.

The code C301 is the fifth entry in the list of codes. The final 0 asks for an exact match. Never leave it out.

Step 2: INDEX returns what is at a position

INDEX is handed a range and a position, and returns the cell there.

The fifth item name, and the fifth price.

Step 3: put MATCH inside INDEX

Replace the typed 5 with the MATCH formula that produced it.

That is the whole technique. In words: "from the column I want an answer from, give me the item at the position where the code is found".

The pattern to remember:

=INDEX(answer_column, MATCH(what_to_find, search_column, 0))

In real use, the code would be in a cell, not typed into the formula: =INDEX($D$2:$D$8,MATCH(G2,$A$2:$A$8,0)).

What VLOOKUP cannot do

Look to the left. VLOOKUP's answer must be to the right of the column it searches. With INDEX and MATCH the two columns are independent.

The search is in column B and the answer comes from column A.

Survive a new column. VLOOKUP holds a column number such as 4. Insert a column inside the table and it returns the wrong thing. INDEX holds a reference to the answer column itself, which moves along when columns are inserted.

Stay fast on big tables. VLOOKUP is given the whole table. INDEX and MATCH are given only the two columns they need.

A two-way lookup

Add a second MATCH to find the column as well as the row. This reads a value from the meeting point of a row label and a column heading.

The first MATCH says row 7, the second says column 5, and INDEX returns the cell where they cross. Change "Stock" to "Price" and the same formula returns the price. Put the heading in a cell and the user can choose which detail to see.

A lookup on two conditions

Sometimes one column does not identify a row. In the sales sample, to find the amount of the sale made by Meena in the East region, both must match.

Sample sheet: Twelve sales made by four salespeople in three regions.
ABCDEF
1DateSalespersonRegionProductUnitsAmount
205-Jan-2026AshaNorthNotebook201200
312-Jan-2026RaviSouthPen50500
420-Jan-2026MeenaNorthBag43000
502-Feb-2026AshaEastPen30300
614-Feb-2026KabirSouthNotebook15900
728-Feb-2026RaviNorthBag21500
803-Mar-2026MeenaEastNotebook402400
915-Mar-2026AshaNorthBag32250
1022-Mar-2026KabirSouthPen60600
1101-Apr-2026RaviEastNotebook251500
1218-Apr-2026MeenaNorthPen80800
1306-May-2026AshaSouthBag53750

Each test gives TRUE or FALSE for every row. Multiplied together they give 1 only where both are true. MATCH then looks for the first 1. In Excel 2021 and Microsoft 365 this works as typed. In older versions, confirm it with Ctrl, Shift and Enter together.

The closest match in bands

MATCH with a last argument of 1 finds the largest value that does not exceed the lookup value, in a list sorted upwards. That is how marks become grades and amounts become slabs.

Sample sheet: A marks table and a grade table. The grade table lists the lowest mark of each grade, in rising order.
ABCDE
1NameMarksFromGrade
2Asha910E
3Ravi4533D
4Meena7950C
5Kabir2865B
6Tara6580A

Handling a value that is not found

MATCH returns #N/A when the value is missing, and INDEX passes the error on.

IFNA replaces only the "not found" error and lets other mistakes show. See IFERROR.

The mistakes people make

INDEX MATCH or XLOOKUP?

In Excel 2021 and Microsoft 365, XLOOKUP does a simple lookup in one function and is easier to read. Use it when everyone who opens the file has a recent version. Use INDEX and MATCH when the workbook must work in Excel 2019 or earlier, and for two-way lookups, where it remains the clearest method. The comparison page VLOOKUP or XLOOKUP has more.

Every result on this page was calculated in Microsoft Excel (version 16.0, build 20326) on 12 November 2026, not typed by hand.

This is an independent help site. It is not connected with or approved by Microsoft. Excel and Microsoft 365 are trademarks of Microsoft Corporation, named here only to say which program a formula is for. The people and figures in the sample sheets are made up.