The last argument in VLOOKUP decides how the function matches. FALSE asks for an exact match. TRUE, or leaving the argument out, asks for an approximate match. The two behave differently, and the wrong choice can give you a wrong answer without any error message.
What the last argument does
- Exact match (FALSE or 0): VLOOKUP looks for a value that is the same as the lookup value. If none exists, it returns #N/A. The list does not need to be sorted.
- Approximate match (TRUE or 1, or left out): VLOOKUP finds the largest value in the first column that is less than or equal to the lookup value, then returns the value from that row. The first column must be sorted in ascending order.
When to use exact match
Use exact match when a value either matches or does not: product codes, employee IDs, invoice numbers and customer names. Most everyday lookups should use it.
Exact match is not case sensitive, so “abc” and “ABC” are treated as the same. In text lookups it also accepts the wildcards * (any run of characters) and ? (one character).
When approximate match makes sense
Approximate match suits tables where each row starts a band, such as commission tiers, tax brackets, shipping weight bands or grade cutoffs. Here is a small commission table, with the sales thresholds in H2:H5 and the rates in I2:I5:
| Sales from | Rate |
|---|---|
| 0 | 2% |
| 5,000 | 3% |
| 10,000 | 4% |
| 20,000 | 5% |
If sales for a salesperson are in B2, this formula returns the rate for that band:
=VLOOKUP(B2, $H$2:$I$5, 2, TRUE)
A sale of 7,250 falls between 5,000 and 10,000, so it returns 3%. A sale of exactly 5,000 also returns 3%, because 5,000 is the largest threshold that is less than or equal to it. A sale of 4,999 returns 2%.
For a fuller commission setup with more than one rule, tiered commission formula in excel goes further.
Why unsorted data gives wrong answers
Approximate match assumes the first column is in ascending order. If it is not, the formula can return a value from an unexpected row, and Excel will not warn you. If the lookup value is smaller than the smallest value in the first column, the result is #N/A.
Before you trust an approximate match, check that the first column runs from smallest to largest. If it does not, sort the table by that column first.
Set the argument yourself
Leaving out the last argument is the easiest way to get an approximate match by accident. Type FALSE for lookups of IDs, codes and names. For tiered tables, type TRUE so that anyone reading the formula later can see what you meant.
XLOOKUP avoids this trap because it matches exactly by default. How to use xlookup in excel explains how it works.