- Explain the four arguments of VLOOKUP and build an exact-match lookup
- Find the cause of #N/A and other typical errors
- Know the advantages of XLOOKUP
A stationery shop's price list has hundreds of products. The cashier types only the code — the product name and price should appear on their own. Searching the list by eye every time is slow and error-prone. One of Excel's most famous functions does this job: VLOOKUP (DÜŞEYARA in Turkish Excel).
How VLOOKUP works
- lookup_valuethe value to look for, e.g. a product code
- table_arraythe table; the search happens in its first column
- col_index_numwhich column of the table to return (1, 2, 3…)
- range_lookup
FALSE(or 0) — exact match;TRUE— approximate match
- 1Take the value
=VLOOKUP(E2,$A$2:$C$7,3,FALSE)first takes the code in E2, for exampleP104. - 2Search the first column
Excel searches A2:A7 from top to bottom for
P104and stops at the first row where it finds it. - 3Count to the right
In that row it moves to column 3 of the table: A is 1, B is 2, C is 3.
- 4Return the result
The price from column C is returned — 18 ₼. If the code isn't found, the result is #N/A.
Approximate match: looking up by bands
E2:F5 holds a scale: column E has 0, 50, 75, 90 (lower limits in ascending order), column F has 2, 3, 4, 5. The score in B2 is 83. How do you find the mark?
Show solutionHide solution
=VLOOKUP(B2,$E$2:$F$5,2,TRUE)With
TRUE, Excel finds the largest limit that is less than or equal to 83 — that is 75.Column 2 of that row: 4.
Requirement: the first column must be sorted in ascending order.
XLOOKUP: the modern replacement
- lookup_arraythe column to search in
- return_arraythe column to take the result from
- if_not_foundtext to show when nothing is found (optional)
XLOOKUP is available in Microsoft 365, Excel 2021 and newer. The same lookup is written like this: =XLOOKUP(E2,A2:A7,C2:C7,"Code not found"). There is no column number to count, exact match is the default, and the result column can even be to the left of the lookup column. Educora's practice sheet supports only VLOOKUP, but do try XLOOKUP in real Excel.
| Feature | VLOOKUP | XLOOKUP |
|---|---|---|
| Default match | approximate (you must add FALSE) | exact |
| Can look to the left? | no | yes |
| When you insert a column | the column number goes out of date | the formula stays correct |
| When nothing is found | #N/A (needs IFERROR) | your own text (if_not_found) |
| Versions | all versions | Microsoft 365, Excel 2021+ |
Key points
- VLOOKUP searches the first column of a table and returns a value from the column you specify.
- For an exact match the 4th argument must be
FALSE(or 0); lock the table with$. - #N/A means the value was not found; show a clear message with IFERROR.
- An approximate match with
TRUEworks with bands, but the first column must be sorted ascending. - XLOOKUP matches exactly by default, can look left and doesn't break when columns are inserted.
Check yourself
10 questions. Every correct answer earns XP.