INDEX MATCH in Excel: left lookups and two-way lookups step by step
INDEX and MATCH together do what VLOOKUP can’t: look left, look up by row and column, match two criteria. How to build the formula, plus traps.
INDEX MATCH isn’t one function but a pair: MATCH finds the position of a value, and INDEX takes the value at that position from another column. Like finding the address first and then opening the door.
Why analysts love it:
- It looks in any direction — even when the result column is on the left.
- Two-way lookups: it finds the intersection of a row header and a column header.
- It doesn’t break when columns are inserted — there is no column number.
- It works in every version of Excel, unlike XLOOKUP.
Example: find a product’s code by its name. The code column is to the left of the names — VLOOKUP is helpless here.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Code | Product | Price | Product: | Milk1 | ||
| 2 | M01 | Bread | 4 000 | Code: | M02 | ||
| 3 | M023 | Milk2 | 12 000 | ||||
| 4 | M03 | Yogurt | 9 000 | ||||
| 5 | M04 | Eggs | 1 500 | ||||
| 6 | M05 | Rice | 18 000 | ||||
| 7 |
How the formula is built
One-way lookup:
=ИНДЕКС(return_range; ПОИСКПОЗ(lookup_value; lookup_range; 0))
return_range— the column to return from (A2:A6).lookup_value— what to find (F1).lookup_range— where to look (B2:B6). It must start on the same row asreturn_range.0— exact match.
Two-way lookup — MATCH twice:
=ИНДЕКС(table; ПОИСКПОЗ(row_value; row_headers; 0); ПОИСКПОЗ(col_value; col_headers; 0))
Read the formula from the inside out: first MATCH produces a number, then INDEX uses it.
Building the formula from the inside out
1
Start with MATCH alone. Type =ПОИСКПОЗ(F1;B2:B6;0) in F2 (via Формулы → Ссылки и массивы → MATCH, or by hand). The result is 2: milk is in position 2.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Code | Product | Price | Product: | Milk | ||
| 2 | M01 | Bread | 4 000 | Position: | 2 | ||
| 3 | M02 | Milk | 12 000 | Code: | |||
| 4 | M03 | Yogurt | 9 000 | ||||
| 5 | M04 | Eggs | 1 500 | ||||
| 6 | M05 | Rice | 18 000 | ||||
| 7 |
2
In F3, write INDEX and give it F2 as the row number: =ИНДЕКС(A2:A6;F2). The result is M02. With two helper cells the logic is plain to see.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Code | Product | Price | Product: | Milk | ||
| 2 | M01 | Bread | 4 000 | Position: | 21 | ||
| 3 | M022 | Milk | 12 000 | Code: | M02 | ||
| 4 | M03 | Yogurt | 9 000 | ||||
| 5 | M04 | Eggs | 1 500 | ||||
| 6 | M05 | Rice | 18 000 | ||||
| 7 |
3
Now combine them: replace F2 inside INDEX with the MATCH formula itself — =ИНДЕКС(A2:A6;ПОИСКПОЗ(F1;B2:B6;0)). The helper cell is no longer needed.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Code | Product | Price | Product: | Milk | ||
| 2 | M01 | Bread | 4 000 | Code: | M02 | ||
| 3 | M02 | Milk | 12 000 | ||||
| 4 | M03 | Yogurt | 9 000 | ||||
| 5 | M04 | Eggs | 1 500 | ||||
| 6 | M05 | Rice | 18 000 | ||||
| 7 |
4
If you plan to fill the formula down, lock the ranges with F4: =ИНДЕКС($A$2:$A$6;ПОИСКПОЗ(F1;$B$2:$B$6;0)).
Two-way lookup: a delivery price
A courier price depends on two things: the region (row) and the weight (column). One MATCH finds the row number, the other finds the column number, and INDEX takes the price where they meet:
=ИНДЕКС(B2:D5;ПОИСКПОЗ(B6;A2:A5;0);ПОИСКПОЗ(B7;B1:D1;0))
Change the choices in B6 and B7 and the price updates by itself. This kind of “calculator” is perfect for tariff grids, tax rates and exchange-rate tables.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Region | 1 kg | 5 kg2 | 10 kg | |
| 2 | Tashkent | 15 000 | 25 000 | 40 000 | |
| 3 | Samarkand | 25 000 | 38 000 | 55 000 | |
| 4 | Bukhara1 | 30 000 | 45 0003 | 65 000 | |
| 5 | Khorezm | 35 000 | 52 000 | 75 000 | |
| 6 | Region: | Bukhara | |||
| 7 | Weight: | 5 kg | |||
| 8 | Price: | 45 000 | |||
| 9 |
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Code | Product | Price | Product: | Milk | ||
| 2 | M01 | Bread | 4 000 | Code: | M031 | ||
| 3 | M02 | Milk | 12 000 | ||||
| 4 | M03 | Yogurt | 9 000 | ||||
| 5 | M04 | Eggs | 1 500 | ||||
| 6 | M05 | Rice | 18 000 | ||||
| 7 |
Which one: VLOOKUP, INDEX MATCH or XLOOKUP?
- VLOOKUP — the simplest; only looks right and breaks when columns are inserted. Fine for small, stable tables.
- INDEX MATCH — works in every version, looks in any direction and in two dimensions, survives inserted columns. If the file is opened in different Excel versions, it is the safest choice.
- XLOOKUP — the most convenient and shortest, but only in Excel 2021/365.
Rule of thumb: the file lives only in 365 — XLOOKUP; colleagues may have older Excel — INDEX MATCH.
Pro level: lookup by two criteria
You need sales for a branch and a month. There are two ways.
1. A helper column (all versions): add a key column such as =B2&"_"&C2 at the start of the table and build the lookup value the same way:
=ИНДЕКС(D2:D5;ПОИСКПОЗ(B7&"_"&D7;A2:A5;0))
2. An array formula (no helper column):
=ИНДЕКС(D2:D5;ПОИСКПОЗ(1;(B2:B5=B7)*(C2:C5=D7);0))
Each condition produces a TRUE/FALSE array; multiplied together, they give 1 only where both conditions hold, and MATCH looks for that 1. In Excel 365 a plain Enter is enough; in older versions press Ctrl + Shift + Enter.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Key | Branch | Month | Sales | |
| 2 | Tashkent_Jan | Tashkent | Jan | 120 | |
| 3 | Tashkent_Feb | Tashkent | Feb | 150 | |
| 4 | Samarkand_Jan | Samarkand | Jan | 90 | |
| 5 | Samarkand_Feb | Samarkand | Feb | 95 | |
| 6 | |||||
| 7 | Branch: | Samarkand | Month: | Feb | |
| 8 | Sales: | 95 | |||
| 9 |
Try it in the simulator
Type the two-way formula in B8: =ИНДЕКС(B2:D5;ПОИСКПОЗ(B6;A2:A5;0);ПОИСКПОЗ(B7;B1:D1;0)). Then type “Khorezm” in B6 and “10 kg” in B7 and check how the price changes.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Region | 1 kg | 5 kg | 10 kg | ||||||||||||||||||||
| 2 | Tashkent | 15000 | 25000 | 40000 | ||||||||||||||||||||
| 3 | Samarkand | 25000 | 38000 | 55000 | ||||||||||||||||||||
| 4 | Bukhara | 30000 | 45000 | 65000 | ||||||||||||||||||||
| 5 | Khorezm | 35000 | 52000 | 75000 | ||||||||||||||||||||
| 6 | Region: | Bukhara | ||||||||||||||||||||||
| 7 | Weight: | 5 kg | ||||||||||||||||||||||
| 8 | Price: | |||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||
| 12 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.