Why does an approximate-match VLOOKUP return #N/A?
Formula (Excel and Google Sheets)
=XLOOKUP(B2,$E$2:$E$4,$F$2:$F$4,0,-1)The value is below the first entry in the table. Give that case a result, =XLOOKUP(B2,$E$2:$E$4,$F$2:$F$4,0,-1), or start the table at 0.
- Result on the example
- one result per row in
C2, filled down toC7 - Works in
- Excel 2021, 2024 and Microsoft 365
- Google Sheets
- Same formula
See it work
The formula is already in C2, filled down to C7. Change any input and the result updates, or edit the formula to experiment.
How it works
An approximate match returns the largest entry that is less than or equal to the value. A quantity of 6 is below the first tier, 10, so there is nothing to return and VLOOKUP shows #N/A. XLOOKUP's fourth argument supplies 0 for that case, and match mode -1 means "exact or next smaller".
=XLOOKUP(B2,$E$2:$E$4,$F$2:$F$4,0,-1)Result0
B26The value in B2.
$E$2:$E$43 rows × 1 col: 10, 50, 100A range: 3 cells in one column.
$F$2:$F$43 rows × 1 col: 5%, 10%, 15%A range: 3 cells in one column.
-1-1Makes the value negative.
XLOOKUP(B2,$E$2:$E$4,$F$2:$F$4,0,-1)0XLOOKUP: Searches one range and returns the matching item from another.- lookup_value
B26 - lookup_array
$E$2:$E$43 rows × 1 col: 10, 50, 100 - return_array
$F$2:$F$43 rows × 1 col: 5%, 10%, 15% - if_not_found
0 - match_mode
-1-1
- lookup_value
In Google Sheets
The same formula works in Google Sheets: =XLOOKUP(B2,$E$2:$E$4,$F$2:$F$4,0,-1). We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =IFNA(VLOOKUP(B2,$E$2:$F$4,2,TRUE),0) | 0%, 5%, 15%… | For Excel 2019 and earlier: catch the #N/A for quantities below the first tier. |
| =IFNA(INDEX($F$2:$F$4,MATCH(B2,$E$2:$E$4,1)),0) | 0%, 5%, 15%… | MATCH with 1 is the same approximate match. |
Common mistakes
- The cleanest fix is a first tier that starts at 0 with a 0% discount, so every quantity has a row.
- VLOOKUP with TRUE needs the first column sorted smallest to largest; unsorted tiers give wrong rates rather than errors. XLOOKUP with -1 doesn't need sorting.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Why does an approximate-match VLOOKUP return #N/A
C2, return the discount for the quantity from the tiers in E2:F4, and 0% for quantities below the first tier. Fill down to C7.Questions
Why doesn't XLOOKUP need sorted tiers here?
With the default search mode, XLOOKUP checks every row for the best match. Only the binary search modes (2 and -2) need sorted data.
How do I look up bands defined by their upper limit?
Use match mode 1, "exact or next larger": =XLOOKUP(B2,upper_limits,results,,1).
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.