How to Use INDEX and MATCH in Google Sheets (With Examples)

VLOOKUP has one rule that has quietly broken more sheets than any bug: the answer must sit to the right of the key, and you must count how many columns over it is. Insert a column, and the count is wrong — silently. INDEX and MATCH exist to remove both constraints at once. MATCH finds where the key is, INDEX returns what sits at that position in a completely different column, and neither one cares which side of the key the answer lives on.
This guide builds the combination from the same price-list example as our VLOOKUP guide and our XLOOKUP guide, explains the two functions separately first — because the combination only makes sense once you see what each half does — then covers the two-dimensional lookup and the multiple-criteria trick, and ends with the fix for every error the pair can throw.
What MATCH Does on Its Own
MATCH never returns a value. It returns a position — a number — and that is the whole point.
The syntax:
=MATCH(search_key, range, [search_type])
| Argument | What it is | Example |
|---|---|---|
| search_key | The value to find — a literal or a cell reference | ”SKU-103” or F2 |
| range | The single row or column to search | B2:B6 |
| search_type | 0 = exact match, 1 = less than or equal (sorted ascending), -1 = greater than or equal (sorted descending) | 0 |
Same sheet as the VLOOKUP guide: product names in column A, SKUs in column B, prices in column C, stock levels in column D — data in rows 2 through 6. The SKU you care about sits in cell F2.
=MATCH(F2, B2:B6, 0)
If F2 holds “SKU-103” and that SKU is the third row of the range B2:B6, MATCH returns 3. Two details in that sentence matter more than the formula itself. First, the 3 is a position inside the range, not a sheet row number — SKU-103 lives on sheet row 4, but it is row 3 of B2:B6, and MATCH counts from the range, not from the sheet. Second, the 0 is doing real work: it demands an exact match. Unlike XLOOKUP, whose default is exact, MATCH defaults to search_type 1 — approximate matching on sorted data — so leaving the third argument off is the classic INDEX/MATCH footgun. Always write the 0.
What INDEX Does on Its Own
INDEX is the other half: give it a range and a position, and it hands back the value sitting there.
The syntax:
=INDEX(reference, [row], [column])
=INDEX(C2:C6, 3) returns the third value in the price column — the price on the third data row. With a single-column range the column argument is unnecessary; with a multi-column range it picks the column too, which is what makes the two-dimensional lookup below possible. INDEX counts from the top of the range you hand it, exactly the way MATCH counts — that shared counting is why the two functions fit together.
Step by Step: Your First INDEX/MATCH
The combination is one formula with MATCH nested where INDEX expects its row number:
=INDEX(C2:C6, MATCH(F2, B2:B6, 0))
- Click the cell where the answer should appear — G2 here.
- Type =INDEX(C2:C6, MATCH(F2, B2:B6, 0)).
- Press Enter. The price for that SKU appears.
Read it inside out, the way Sheets evaluates it. MATCH searches B2:B6 for the SKU in F2 and returns its position — say 3. INDEX then takes the third value from C2:C6. The two ranges start on the same row, so position 3 means the same record in both. That alignment is the one mechanical requirement: the lookup range and the result range must start on the same row (or the same column, for horizontal lookups), or the positions stop lining up.
Three Things INDEX/MATCH Does That VLOOKUP Can’t
1. It looks left. Because the result range is independent of the search range, the answer can sit anywhere — including left of the key. Given a SKU, return the product name stored one column to its left:
=INDEX(A2:A6, MATCH(F2, B2:B6, 0)) — a formula VLOOKUP simply cannot express, and the reason INDEX/MATCH became the standard workaround before XLOOKUP existed.
2. Inserting a column breaks nothing. VLOOKUP hardcodes the answer’s column as a number, so inserting a column between the SKUs and the prices shifts every answer by one — silently. INDEX/MATCH names two ranges, and Sheets adjusts both references when the layout changes. The formula still reads prices after the edit, for the same reason XLOOKUP survives it.
3. It works in old Excel. XLOOKUP needs Excel for Microsoft 365 or Excel 2021 or later. INDEX and MATCH have existed in every version of Excel for decades, so a file built on them opens and calculates everywhere — the safe choice when a sheet has to travel to someone on old software.
Two-Dimensional Lookup: Row and Column at Once
One MATCH finds a row. Two MATCHes find a cell — the row from one key, the column from another — and that is the lookup VLOOKUP and XLOOKUP both need nesting to imitate.
Suppose the header row holds the field names: A1 is “Product”, B1 is “SKU”, C1 is “Price”, D1 is “Stock”. To find the price for the SKU in F2, with the column chosen by the header text in H2:
=INDEX(A2:D6, MATCH(F2, B2:B6, 0), MATCH(H2, A1:D1, 0))
The first MATCH returns the row position, the second returns the column position, and INDEX reads the cell where they cross. Change H2 from “Price” to “Stock” and the same formula returns the stock level — the column is data now, not a hardcoded number. That is the whole technique: any time a lookup needs two keys, give each one its own MATCH.
Multiple Criteria: Matching Two Columns at Once
Sometimes one key is not enough — the same SKU appears in two sizes, or the same product in two warehouses, and only the pair identifies the row. Take a variant table where column A holds the product, column B the size, and column C the price. The pattern multiplies two TRUE/FALSE conditions into 1s and 0s, then matches the 1:
=ARRAYFORMULA(INDEX(C2:C6, MATCH(1, (A2:A6=“Mug”)*(B2:B6=“Large”), 0)))
Each parenthesised comparison produces TRUE or FALSE per row; multiplying them gives 1 only where both are true. MATCH finds that 1, INDEX returns the price from the same row. The ARRAYFORMULA wrapper is required — without it, Sheets evaluates the multiplication for one row only. Keep the ranges the same height, and keep the criteria in cells rather than literals when the sheet will be reused.
Every Error INDEX/MATCH Can Throw
| Error | What it means | Fix |
|---|---|---|
| #N/A | MATCH found no exact match, or INDEX was given a position past the range | Check the key (typos, spaces, text-numbers); check both ranges start on the same row |
| #VALUE! | A search_type other than 0, 1, or -1, or the ARRAYFORMULA pattern without its wrapper | Use 0 for exact matches; wrap multiple-criteria formulas in ARRAYFORMULA |
| #REF! | INDEX was asked for a row or column beyond the range | Recount the range — the position MATCH returns must fit inside the INDEX range |
| Wrong value, no error | MATCH ran in approximate mode (search_type 1, the default) on unsorted data, or duplicate keys | Always pass 0 for exact matches; make keys unique — the cleanup routes in removing duplicates in Google Sheets apply unchanged |
#N/A: the key wasn’t found — or the ranges are misaligned
The most common #N/A is a key problem, the same three suspects as VLOOKUP’s: a typo, invisible trailing spaces (fix with =TRIM() on the source), and numbers stored as text that will never equal the numeric version of themselves. The INDEX/MATCH-specific variant is misalignment: if the lookup range starts on row 2 but the result range starts on row 3, every position is off by one and the answers are wrong — or #N/A when the last position falls outside the range. Both ranges must start on the same row.
Wrong record, no error: the missing 0
This is the error with no error message. =MATCH(F2, B2:B6) without the third argument defaults to search_type 1, which assumes sorted data and returns the largest value less than or equal to the key. On unsorted SKUs that is a random row’s position, and INDEX dutifully returns that row’s price. The fix is one character: always write the 0.
#VALUE!: the ranges don’t match in size
In the multiple-criteria pattern, the multiplied conditions must all cover the same number of rows. A2:A6 against B2:B5 is a size mismatch, and Sheets refuses. Equalize the ranges, or switch both to whole columns — A:A with B:B — which can never mismatch, at the cost of scanning the whole column.
The Limitations Worth Knowing
- No built-in not-found message. XLOOKUP’s fourth argument replaces #N/A with friendly text natively. INDEX/MATCH needs a wrapper: =IFERROR(INDEX(C2:C6, MATCH(F2, B2:B6, 0)), “Not in list”).
- One match only — the first. With duplicate keys, MATCH returns the first match, top to bottom. If the last row is what you actually wanted, there is no search_mode -1 to reach for, the way XLOOKUP has; the real fix is making the keys unique.
- Harder to read than XLOOKUP. Two nested functions with a position number passing between them is genuinely harder to scan than one function with named ranges. For a new sheet that will never leave modern software, XLOOKUP says the same thing more clearly — INDEX/MATCH earns its place when compatibility or a two-dimensional lookup is the deciding factor.
- Case sensitivity: still none. “sku-103” matches “SKU-103”, exactly as with VLOOKUP and XLOOKUP. Build an =EXACT() helper column if your data truly needs the distinction.
Frequently Asked Questions
Is INDEX/MATCH better than VLOOKUP?
Yes, for anything where the layout might change or the answer sits left of the key: no column counting, no direction limit, and it survives inserted columns. VLOOKUP still reads more clearly for a simple, stable, right-ward lookup in a sheet that will never be restructured.
Why does my INDEX/MATCH return the wrong row?
Almost always the missing 0. Without search_type 0, MATCH defaults to approximate matching and returns a position from sorted-data logic applied to unsorted data. Add the 0; if the answer is still wrong, check that both ranges start on the same row.
Can INDEX/MATCH return multiple matches for one key?
No. It returns one match — the first. To pull every matching row into a list, use FILTER with the same condition you’d have given MATCH.
Does INDEX/MATCH work in Excel too?
Yes, in every version of Excel, with the same argument order as Google Sheets — formulas move between the two without translation. That is its main advantage over XLOOKUP, which needs Excel for Microsoft 365 or Excel 2021 or later.
INDEX/MATCH or XLOOKUP — which should I use?
XLOOKUP for new sheets in modern software: one function, exact match by default, a built-in not-found message, and it returns several columns at once. INDEX/MATCH when the file must survive old Excel, or when the lookup is genuinely two-dimensional and two MATCHes read more honestly than nested XLOOKUPs.
Sources: