Look up in any direction with INDEX and MATCH
Find a value in a table even when the answer is to the left of the column you search, in any version of Excel and in Google Sheets.
FormulasIntermediate10 minExcel · Google Sheets
Example content. The numbers are fictional and made for learning.
Goal
Find the price of product P-103 from a product list.
Why this is useful
VLOOKUP can only return columns to the right of the one it searches, and breaks when columns are inserted. INDEX and MATCH have neither problem and work in every version.
Example
| Row | A | B | C |
|---|---|---|---|
| 1 | Code | Product | Price |
| 2 | P-101 | Mug | 24 |
| 3 | P-102 | Tote bag | 32 |
| 4 | P-103 | 15 | |
| 5 | P-104 | Greeting card | 4.5 |
| 6 | Price of P-103 | 15.00=INDEX(C2:C5,MATCH("P-103",A2:A5,0)) |
Steps
1. MATCH finds the row
=MATCH("P-103",A2:A5,0) returns 3, because P-103 is the third item in the list. The 0 asks for an exact match. Swedish uses PASSA.
2. INDEX returns the value
=INDEX(C2:C5,3) returns the third value in the price column. INDEX has the same name in Swedish.
3. Put them together
Replace the 3 with the MATCH: =INDEX(C2:C5,MATCH("P-103",A2:A5,0)). Point at a cell instead of typing the code: MATCH(F2,A2:A5,0).
4. Look to the left
Search the product names and return the code: =INDEX(A2:A5,MATCH("Print",B2:B5,0)). VLOOKUP cannot do this.
5. Lock and hide misses
Lock the ranges with $ before copying, and wrap the formula in IFERROR to show a message when the value is missing.
Formulas by language
Cell names such as B2 stay the same. The function name and the character between arguments follow the spreadsheet language. The English line in each list is the reference form used on this site, not a universal spelling. When the decimal sign is a comma, arguments are usually separated with a semicolon, because the comma is already used in numbers.
The position of P-103 in the list: 3.
English (United States)
Decimals look like 1.5. Arguments are separated with ,.
=MATCH("P-103",A2:A5,0)Swedish (Sweden)
Decimals look like 1,5. Arguments are separated with ;.
=PASSA("P-103";A2:A5;0)German (Germany)
Decimals look like 1,5. Arguments are separated with ;.
=VERGLEICH("P-103";A2:A5;0)French (France)
Decimals look like 1,5. Arguments are separated with ;.
=EQUIV("P-103";A2:A5;0)Spanish (Spain)
Decimals look like 1,5. Arguments are separated with ;.
=COINCIDIR("P-103";A2:A5;0)Spanish (Mexico)
Decimals look like 1.5. Arguments are separated with ,.
=COINCIDIR("P-103",A2:A5,0)Portuguese (Brazil)
Decimals look like 1,5. Arguments are separated with ;.
=CORRESP("P-103";A2:A5;0)Italian (Italy)
Decimals look like 1,5. Arguments are separated with ;.
=CONFRONTA("P-103";A2:A5;0)Dutch (Netherlands)
Decimals look like 1,5. Arguments are separated with ;.
=VERGELIJKEN("P-103";A2:A5;0)
The price on that row: 15.
English (United States)
Decimals look like 1.5. Arguments are separated with ,.
=INDEX(C2:C5,MATCH("P-103",A2:A5,0))Swedish (Sweden)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX(C2:C5;PASSA("P-103";A2:A5;0))German (Germany)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX(C2:C5;VERGLEICH("P-103";A2:A5;0))French (France)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX(C2:C5;EQUIV("P-103";A2:A5;0))Spanish (Spain)
Decimals look like 1,5. Arguments are separated with ;.
=INDICE(C2:C5;COINCIDIR("P-103";A2:A5;0))Spanish (Mexico)
Decimals look like 1.5. Arguments are separated with ,.
=INDICE(C2:C5,COINCIDIR("P-103",A2:A5,0))Portuguese (Brazil)
Decimals look like 1,5. Arguments are separated with ;.
=ÍNDICE(C2:C5;CORRESP("P-103";A2:A5;0))Italian (Italy)
Decimals look like 1,5. Arguments are separated with ;.
=INDICE(C2:C5;CONFRONTA("P-103";A2:A5;0))Dutch (Netherlands)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX(C2:C5;VERGELIJKEN("P-103";A2:A5;0))
A lookup to the left: the code for Print, P-103.
English (United States)
Decimals look like 1.5. Arguments are separated with ,.
=INDEX(A2:A5,MATCH("Print",B2:B5,0))Swedish (Sweden)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX(A2:A5;PASSA("Print";B2:B5;0))German (Germany)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX(A2:A5;VERGLEICH("Print";B2:B5;0))French (France)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX(A2:A5;EQUIV("Print";B2:B5;0))Spanish (Spain)
Decimals look like 1,5. Arguments are separated with ;.
=INDICE(A2:A5;COINCIDIR("Print";B2:B5;0))Spanish (Mexico)
Decimals look like 1.5. Arguments are separated with ,.
=INDICE(A2:A5,COINCIDIR("Print",B2:B5,0))Portuguese (Brazil)
Decimals look like 1,5. Arguments are separated with ;.
=ÍNDICE(A2:A5;CORRESP("Print";B2:B5;0))Italian (Italy)
Decimals look like 1,5. Arguments are separated with ;.
=INDICE(A2:A5;CONFRONTA("Print";B2:B5;0))Dutch (Netherlands)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX(A2:A5;VERGELIJKEN("Print";B2:B5;0))
The code comes from F2; a message replaces #N/A.
English (United States)
Decimals look like 1.5. Arguments are separated with ,.
=IFERROR(INDEX($C$2:$C$5,MATCH(F2,$A$2:$A$5,0)),"Not found")Swedish (Sweden)
Decimals look like 1,5. Arguments are separated with ;.
=OMFEL(INDEX($C$2:$C$5;PASSA(F2;$A$2:$A$5;0));"Not found")German (Germany)
Decimals look like 1,5. Arguments are separated with ;.
=WENNFEHLER(INDEX($C$2:$C$5;VERGLEICH(F2;$A$2:$A$5;0));"Not found")French (France)
Decimals look like 1,5. Arguments are separated with ;.
=SIERREUR(INDEX($C$2:$C$5;EQUIV(F2;$A$2:$A$5;0));"Not found")Spanish (Spain)
Decimals look like 1,5. Arguments are separated with ;.
=SI.ERROR(INDICE($C$2:$C$5;COINCIDIR(F2;$A$2:$A$5;0));"Not found")Spanish (Mexico)
Decimals look like 1.5. Arguments are separated with ,.
=SI.ERROR(INDICE($C$2:$C$5,COINCIDIR(F2,$A$2:$A$5,0)),"Not found")Portuguese (Brazil)
Decimals look like 1,5. Arguments are separated with ;.
=SEERRO(ÍNDICE($C$2:$C$5;CORRESP(F2;$A$2:$A$5;0));"Not found")Italian (Italy)
Decimals look like 1,5. Arguments are separated with ;.
=SE.ERRORE(INDICE($C$2:$C$5;CONFRONTA(F2;$A$2:$A$5;0));"Not found")Dutch (Netherlands)
Decimals look like 1,5. Arguments are separated with ;.
=ALS.FOUT(INDEX($C$2:$C$5;VERGELIJKEN(F2;$A$2:$A$5;0));"Not found")
Two-way: the code in G2 picks the row, and a heading in G3 (Product or Price) picks the column.
English (United States)
Decimals look like 1.5. Arguments are separated with ,.
=INDEX($B$2:$C$5,MATCH(G2,$A$2:$A$5,0),MATCH(G3,$B$1:$C$1,0))Swedish (Sweden)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX($B$2:$C$5;PASSA(G2;$A$2:$A$5;0);PASSA(G3;$B$1:$C$1;0))German (Germany)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX($B$2:$C$5;VERGLEICH(G2;$A$2:$A$5;0);VERGLEICH(G3;$B$1:$C$1;0))French (France)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX($B$2:$C$5;EQUIV(G2;$A$2:$A$5;0);EQUIV(G3;$B$1:$C$1;0))Spanish (Spain)
Decimals look like 1,5. Arguments are separated with ;.
=INDICE($B$2:$C$5;COINCIDIR(G2;$A$2:$A$5;0);COINCIDIR(G3;$B$1:$C$1;0))Spanish (Mexico)
Decimals look like 1.5. Arguments are separated with ,.
=INDICE($B$2:$C$5,COINCIDIR(G2,$A$2:$A$5,0),COINCIDIR(G3,$B$1:$C$1,0))Portuguese (Brazil)
Decimals look like 1,5. Arguments are separated with ;.
=ÍNDICE($B$2:$C$5;CORRESP(G2;$A$2:$A$5;0);CORRESP(G3;$B$1:$C$1;0))Italian (Italy)
Decimals look like 1,5. Arguments are separated with ;.
=INDICE($B$2:$C$5;CONFRONTA(G2;$A$2:$A$5;0);CONFRONTA(G3;$B$1:$C$1;0))Dutch (Netherlands)
Decimals look like 1,5. Arguments are separated with ;.
=INDEX($B$2:$C$5;VERGELIJKEN(G2;$A$2:$A$5;0);VERGELIJKEN(G3;$B$1:$C$1;0))
The same spoken language can use different separators in different countries. Spanish in Spain often uses a comma for decimals and a semicolon between arguments. Spanish in Mexico often uses a period and a comma. If a formula is rejected, check the spreadsheet locale.
Excel and Google Sheets
- INDEX and MATCH work in every version of Excel and in Google Sheets.
- Always give MATCH the 0 at the end. Without it MATCH expects a sorted list and can return a wrong row without any error.
- In Excel 2021, Microsoft 365, and Google Sheets, XLOOKUP does the same in one function.
- Function names and the separator between arguments follow the spreadsheet language. Excel uses the language of your installation; Google Sheets uses the spreadsheet locale under File, Settings.
- Workbooks from Hellosheetwise store formulas in English. Excel and Google Sheets show them in your language when you open the file.
If something goes wrong
The result is #N/A.
The value is not in the search column, or differs by a space or by being text instead of a number.
The result comes from the wrong row.
The two ranges start on different rows, such as C2:C5 and A3:A6. Make them cover the same rows.
Copied formulas break.
Lock the ranges with $ so they do not move when the formula is copied.