Lookups: VLOOKUP, XLOOKUP, INDEX MATCH
Excel · 14 questions
Short notes
Key idea
A lookup finds a value in one table using a key from another, like a SQL join for one column. XLOOKUP is the modern choice; VLOOKUP and INDEX/MATCH are still everywhere.
Syntax
=XLOOKUP(A2, Customers!A:A, Customers!C:C, "Not found")
=VLOOKUP(A2, Customers!A:D, 3, FALSE)
=INDEX(Customers!C:C, MATCH(A2, Customers!A:A, 0))
Example
Orders list has customer IDs in A; the Customers sheet has ID in A and city in C. In the orders sheet: =XLOOKUP(A2, Customers!A:A, Customers!C:C, "Unknown"), fill down. Each order now shows its customer's city, and missing IDs say "Unknown" instead of #N/A.
Traps
- VLOOKUP's last argument must be
FALSE(exact match). Leaving it out gives approximate matches and wrong answers without any error. - VLOOKUP only looks to the right of the key column; XLOOKUP and INDEX/MATCH don't care.
- A hard-coded column number (3) breaks when someone inserts a column.
- Extra spaces or numbers stored as text make keys look equal but not match; use TRIM and VALUE.
- Only the first match is returned when the key repeats.
Want the full lesson with step-by-step examples, a project and a certificate? Excel course, ₹120 →
Questions
5 free questions- Question 1easy
Why should VLOOKUP almost always end with
FALSE? - Question 2medium
The product id is in column C and the product name is in column A. Which can return the name for an id?
- Question 3medium
The Products sheet has id in A, name in B, and price in C.
=VLOOKUP(C2, Products!A:C, 3, FALSE)returns the price. Someone inserts a new "category" column at B, so the sheet becomes id, category, name, price. Excel widens the range automatically. What does the formula below return now?=VLOOKUP(C2, Products!A:D, 3, FALSE)
- Question 4medium
Your lookup returns
#N/A, but you can see id 101 in both sheets. In one sheet it's left-aligned. What's the likely cause? - Question 5hard
The products sheet has headers in A1:E1 and data in A2:E21. A product id is in J1 and a column header (like "price" or "stock") is in J2. Write one formula that returns that column's value for that product.
Write your answer on your own machine, then compare with the solution.
Lookups: VLOOKUP, XLOOKUP, INDEX MATCH
Lookups: VLOOKUP, XLOOKUP, INDEX MATCH
Lookups: VLOOKUP, XLOOKUP, INDEX MATCH
Lookups: VLOOKUP, XLOOKUP, INDEX MATCH
Lookups: VLOOKUP, XLOOKUP, INDEX MATCH
9 more questions on this topic, with hints, and tests
Sign up free for 21 days of every question and test.