In This Guide
Sample Dataset
All examples in this guide use the following product table. Imagine this is your reference table on a sheet called Products:
| Column A: Product Code | Column B: Product Name | Column C: Category | Column D: Price (₹) | Column E: Stock |
|---|---|---|---|---|
| P001 | Wireless Mouse | Electronics | 850 | 120 |
| P002 | USB Hub | Electronics | 650 | 85 |
| P003 | Notebook A5 | Stationery | 45 | 500 |
| P004 | Mechanical Keyboard | Electronics | 2400 | 30 |
| P005 | Desk Lamp | Furniture | 1200 | 60 |
| P006 | Ballpoint Pen (12pk) | Stationery | 80 | 800 |
Your task: a user types a Product Code in cell H2. You need formulas that return the Product Name, Category, Price and Stock for that code.
VLOOKUP: Syntax, Example and Limitations
Syntax
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
- lookup_value — the value to find (e.g., the product code in H2)
- table_array — the range that contains both the key column and the return column
- col_index_num — which column number in the range to return (1 = first, 2 = second, etc.)
- range_lookup — FALSE for exact match, TRUE for approximate match. Always use FALSE.
Examples Using the Sample Dataset
Assume the Products table is in cells A1:E7 (header row + 6 data rows):
=VLOOKUP(H2, $A$2:$E$7, 2, FALSE) → Returns Product Name
=VLOOKUP(H2, $A$2:$E$7, 3, FALSE) → Returns Category
=VLOOKUP(H2, $A$2:$E$7, 4, FALSE) → Returns Price
=VLOOKUP(H2, $A$2:$E$7, 5, FALSE) → Returns Stock
If H2 = "P003", these four formulas return: Notebook A5, Stationery, 45, 500.
Limitations of VLOOKUP
- Lookup column must be leftmost. VLOOKUP can only look left-to-right. If you want to find the Product Code by searching the Product Name (column B), VLOOKUP cannot do it — the search column must always be column A of your selected range.
- Column number is fragile. If you insert a new column between B and C in your Products table, all your VLOOKUP formulas with col_index_num = 3 break silently — they now return the wrong column without showing an error.
- No built-in error handling. If H2 contains "P999" (a code that does not exist), VLOOKUP returns #N/A. You must wrap it in IFERROR manually.
- Finds first match only. If the lookup value appears more than once, VLOOKUP always returns the value from the first match — it cannot return all matches.
INDEX MATCH: Two Functions, One Powerful Lookup
How It Works
INDEX MATCH is not a single function — it is a combination. MATCH finds the row number. INDEX uses that row number to return a value from any column you choose.
MATCH(lookup_value, lookup_range, 0) → Returns the ROW number (position)
INDEX(return_range, row_number) → Returns the VALUE at that row
Syntax Combined
=INDEX(return_column, MATCH(lookup_value, lookup_column, 0))
Examples Using the Sample Dataset
=INDEX($B$2:$B$7, MATCH(H2, $A$2:$A$7, 0)) → Product Name
=INDEX($C$2:$C$7, MATCH(H2, $A$2:$A$7, 0)) → Category
=INDEX($D$2:$D$7, MATCH(H2, $A$2:$A$7, 0)) → Price
=INDEX($E$2:$E$7, MATCH(H2, $A$2:$A$7, 0)) → Stock
Advantages Over VLOOKUP
- Can look in any direction. The lookup column and return column are specified separately — you can look right, left, or in any order.
- Inserting columns does not break it. Because you reference the return column by range (e.g., $D$2:$D$7) rather than a number, inserting a new column simply shifts the reference automatically.
- Works in all Excel versions. INDEX and MATCH have been available since Excel 2003. Ideal for files shared across different Excel versions.
- Two-way lookup. Use two MATCH functions — one for row, one for column — to look up both a row header and a column header simultaneously.
Two-Way Lookup Example
Suppose you have a table of regional monthly targets with months as column headers and regions as row headers. Find the target for "North" in "March":
=INDEX(B2:M10, MATCH("North", A2:A10, 0), MATCH("March", B1:M1, 0))
XLOOKUP: The Modern Replacement
Syntax
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
- lookup_value — what to find
- lookup_array — where to find it (a single column or row)
- return_array — what to return (a single column, row, or multiple columns)
- if_not_found — what to show if no match (built-in error handling — no IFERROR needed)
- match_mode — 0 = exact match (default), -1 = exact or next smaller, 1 = exact or next larger, 2 = wildcard
- search_mode — 1 = first to last (default), -1 = last to first, 2 = binary search ascending, -2 = binary search descending
Examples Using the Sample Dataset
=XLOOKUP(H2, $A$2:$A$7, $B$2:$B$7, "Not found") → Product Name
=XLOOKUP(H2, $A$2:$A$7, $C$2:$C$7, "Not found") → Category
=XLOOKUP(H2, $A$2:$A$7, $D$2:$D$7, "Not found") → Price
=XLOOKUP(H2, $A$2:$A$7, $E$2:$E$7, "Not found") → Stock
Return Multiple Columns in One Formula
XLOOKUP can return an entire row — multiple columns at once — with a single formula:
=XLOOKUP(H2, $A$2:$A$7, $B$2:$E$7, "Not found")
This single formula spills results across four cells: Product Name, Category, Price and Stock. No need to write four separate formulas.
Version Compatibility Note
- Microsoft 365 (all versions): Available
- Excel 2021: Available
- Excel for the Web: Available
- Excel 2019: NOT available
- Excel 2016: NOT available
- Excel 2013 and earlier: NOT available
- Google Sheets: NOT available (use VLOOKUP or INDEX MATCH)
Error Handling Comparison
If the lookup value does not exist in the table:
| Function | Default behaviour when not found | How to handle errors |
|---|---|---|
| VLOOKUP | Returns #N/A error | Wrap in IFERROR: =IFERROR(VLOOKUP(...),"Not found") |
| INDEX MATCH | Returns #N/A error | Wrap in IFERROR or IFNA: =IFERROR(INDEX(MATCH(...)),"Not found") |
| XLOOKUP | Built-in 4th argument handles it | Just pass a 4th argument: =XLOOKUP(H2,A:A,B:B,"Not found") |
Full Comparison Table
| Feature | VLOOKUP | INDEX MATCH | XLOOKUP |
|---|---|---|---|
| Excel version | All versions | All versions | Microsoft 365, Excel 2021+ |
| Can look left of key column | No | Yes | Yes |
| Built-in error handling | No (needs IFERROR) | No (needs IFERROR) | Yes (4th argument) |
| Returns multiple columns | No (one column per formula) | No (one column per formula) | Yes (spill across columns) |
| Two-way lookup | No | Yes (nested MATCH) | Partial (nested XLOOKUP) |
| Fragile to column inserts | Yes (breaks silently) | No | No |
| Wildcard search | Yes | Yes (with MATCH type) | Yes (match_mode=2) |
| Find last match instead of first | No | Requires workaround | Yes (search_mode=-1) |
| Approximate match | Yes (range_lookup=TRUE) | Yes (MATCH type 1 or -1) | Yes (match_mode=-1 or 1) |
| Formula readability | Moderate | Verbose but clear | Most readable |
When to Use Which
- Use XLOOKUP when you are on Microsoft 365 or Excel 2021+. It handles more scenarios with less code. The built-in error handling alone makes it worth using over VLOOKUP.
- Use INDEX MATCH when: (1) the file will be opened on Excel 2016 or 2019, (2) you need a two-way lookup using row and column headers, or (3) you need a left-column lookup in a version without XLOOKUP.
- Use VLOOKUP when: (1) the workbook must work on Excel 2013 or earlier, (2) you are in an environment that has standardised on VLOOKUP and changing conventions would cause confusion, or (3) the interview specifically asks you to demonstrate VLOOKUP.
Trainer's Practical Advice
The biggest mistake I see freshers make is treating VLOOKUP, INDEX MATCH and XLOOKUP as if choosing the "right" one is the important decision. The important decision is understanding what a lookup function does: find a match in one column, return a related value from another. Once that concept is clear, switching between functions takes 5 minutes. What actually takes time — and what interviews test — is whether you can diagnose why a lookup formula returns the wrong answer. Extra spaces? Mismatched data types? Approximate match instead of exact? Those are the real skills. Learn all three functions, but spend twice as much time debugging broken lookups on messy data.
Common Mistakes
| Mistake | Function | Fix |
|---|---|---|
| Using range_lookup=TRUE (or omitting 4th arg) when exact match is needed | VLOOKUP | Always include FALSE as the 4th argument for exact match |
| Selecting the wrong starting column in table_array | VLOOKUP | The first column of table_array must be the lookup column. If your data starts at column C, your array starts at C, not A. |
| Forgetting to use 0 as the 3rd MATCH argument | INDEX MATCH | MATCH with no 3rd argument or 1 means approximate match — always write MATCH(value, range, 0) for exact match |
| Not locking references with $ | All three | Always use absolute references ($A$2:$A$100) for the lookup table so formulas copied across rows do not shift the range |
| Lookup value has leading/trailing spaces | All three | Wrap the lookup value in TRIM: =XLOOKUP(TRIM(H2), ...) |
| Number stored as text in one table, number in the other | All three | Use VALUE() to convert text-numbers to numbers, or TEXT() to match text format |
3 Practice Questions
Question 1
You have a customer table where Customer ID is in column B and Customer Name is in column A. You want to look up a Customer ID (in cell F2) and return the Customer Name. Which function can do this most easily and why?
Answer: XLOOKUP or INDEX MATCH — because the return column (A) is to the LEFT of the lookup column (B). VLOOKUP cannot look left. XLOOKUP formula: =XLOOKUP(F2, $B$2:$B$100, $A$2:$A$100, "Not found"). INDEX MATCH formula: =INDEX($A$2:$A$100, MATCH(F2, $B$2:$B$100, 0))
Question 2
Your VLOOKUP formula is returning #N/A even though you can see the matching value in the table. The lookup column contains employee codes like "EMP001". What are the three most likely causes?
Answer: (1) Extra spaces in the table or lookup value — use TRIM(). (2) Data type mismatch — the lookup value is a number but the table column stores text (or vice versa). (3) The 4th argument (range_lookup) is omitted or TRUE — in sorted data this can return unexpected approximate matches.
Question 3
You need to find the sales figure for "South" region in "Q2" from a cross-tab table. The regions run down the rows (column A) and quarters run across the columns (row 1). Write the formula.
Answer: Use INDEX MATCH with two MATCH functions: =INDEX(B2:E10, MATCH("South", A2:A10, 0), MATCH("Q2", B1:E1, 0)). Alternatively: =XLOOKUP("South", A2:A10, XLOOKUP("Q2", B1:E1, B2:E10))
- VLOOKUP is the most widely known but has the most limitations — column must be leftmost, column number is fragile, no built-in error handling.
- INDEX MATCH works in all Excel versions and can look in any direction — use it for older workbooks and two-way lookups.
- XLOOKUP is the modern choice for Microsoft 365 users — cleaner syntax, built-in error handling, can return multiple columns.
- All three return #N/A (or "Not found") when the lookup value has spaces or data type mismatches with the table. Always check with TRIM and VALUE.
- Learn all three. Interviewers test VLOOKUP specifically. Real work increasingly uses XLOOKUP. Index MATCH is the professional fallback.
Want to Practice Lookup Functions with Real Datasets?
Linkskill Academy's Data Analyst training includes hands-on Excel practice sessions with real-world messy datasets — not textbook examples. You will build lookup formulas that work under real conditions.
Frequently Asked Questions
Should I still learn VLOOKUP if XLOOKUP exists?
Yes. VLOOKUP is still widely tested in Excel interviews. Many companies use older Excel versions that do not support XLOOKUP. Understanding VLOOKUP also builds the conceptual foundation for XLOOKUP — once you understand lookup functions through VLOOKUP, learning XLOOKUP takes less than 30 minutes.
When should I use INDEX MATCH instead of XLOOKUP?
Use INDEX MATCH when: (1) you need to work with Excel 2016 or earlier, (2) the workbook will be shared with users on older Excel versions, or (3) you need a two-way lookup that references both row and column headers simultaneously. In Microsoft 365 or Excel 2021+, XLOOKUP handles most of these scenarios more cleanly.
What is the main limitation of VLOOKUP?
VLOOKUP has three main limitations: (1) the lookup column must always be the leftmost column in the range — it cannot look to the left, (2) you reference columns by number which breaks if columns are inserted or deleted, and (3) it does not handle errors gracefully without wrapping in IFERROR. XLOOKUP fixes all three.
Is XLOOKUP available in all Excel versions?
No. XLOOKUP is available in Microsoft 365, Excel 2021 and Excel for the web. It is NOT available in Excel 2016, Excel 2019, or older versions. If your workbook needs to work on older Excel, use VLOOKUP or INDEX MATCH instead.
Can XLOOKUP replace INDEX MATCH completely?
For most single-column lookups, yes. XLOOKUP handles left-lookup, error handling, approximate match, and returning multiple columns in one formula. However, for advanced two-dimensional lookups (matching both a row and a column header simultaneously), INDEX MATCH with two MATCH functions is still useful.
Why does my VLOOKUP return the wrong value?
The most common causes are: (1) using approximate match (TRUE or 1 as the 4th argument) when exact match is needed, (2) extra spaces in the lookup value or the table — use TRIM() to fix these, (3) the lookup value and table column are different data types (one is a number, the other is text) — use VALUE() to standardise, or (4) the table reference is not locked with $ when copying the formula down rows.