Approximate Match VLOOKUP vs. XLOOKUP: Boundary Value Traps Explained

Approximate Match VLOOKUP vs. XLOOKUP: Boundary Value Traps Explained

When looking up values based on ranges, such as grading scales, pricing plans, or tax rates, VLOOKUP approximate match mode (TRUE) and XLOOKUP approximate matching can often return incorrect values at boundary values (thresholds). This article explains the principles and provides practical recipes for avoiding boundary-value traps when comparing VLOOKUP approximate match and XLOOKUP approximate match.

Quick Fix — 5 Steps to Correct Wrong Values Now

  1. Check table sorting: VLOOKUP approximate match (TRUE) requires ascending sort order.
  2. Switch to XLOOKUP: =XLOOKUP(값, 기준, 결과, "", -1) or 1.
  3. Add a boundary safeguard: Snap values to buckets with FLOOR.MATH/CEILING.MATH.
  4. Check for missing ranges: Use conditional formatting to find gaps.
  5. Handle duplicate boundaries: Use search_mode to choose the first or last definition.

How VLOOKUP Approximate Match Works (Why It Can Seem Wrong)

What TRUE/1 Mode and Ascending Sort Order Mean

=VLOOKUP(찾을값, 표, 열, TRUE) finds the largest value less than or equal to the lookup value. The lookup column must be sorted in ascending order.

When Boundary Values Are Missing or Duplicated

If gaps exist, values between boundaries can fall into the wrong range, and duplicate boundaries can lead to unpredictable selections.

When Data Is Mixed Up (Incorrect Sorting)

If even one row is out of order, an approximate lookup can stop at that point and return an incorrect result.

Using XLOOKUP Approximate Match Correctly (Safe Basics)

match_mode -1 vs. 1

=XLOOKUP(값, 기준범위, 결과범위, "없음", -1)  // Next smaller item (≤)
=XLOOKUP(값, 기준범위, 결과범위, "없음", 1)    // Next larger item (≥)

Search Direction (search_mode)

=XLOOKUP(값, 범위, 결과, , -1, 1)   // Top to bottom
=XLOOKUP(값, 범위, 결과, , -1, -1)  // Bottom to top

XMATCH + INDEX

=INDEX(결과범위, XMATCH(값, 기준범위, -1))
=INDEX(결과범위, XMATCH(값, 기준범위, 1))

Practical Example 1 — Grading Scale (Score to Grade)

Minimum ScoreGrade
0D
60C
70B
80A
90A+

XLOOKUP -1: =XLOOKUP(E2, A2:A6, B2:B6, "등급없음", -1)

Bucket snap: =XLOOKUP(FLOOR.MATH(E2,1), A2:A6, B2:B6, "등급없음", -1)

Prioritize the last definition: =XLOOKUP(E2, A2:A6, B2:B6, "등급없음", -1, -1)

Practical Example 2 — Tiered Rates/Pricing Plans

Minimum UsageUnit Price (KRW)
0100
10090
30080
50070

Rate by range: =XLOOKUP(G2, A2:A5, B2:B5, "", -1)

Tiered total: After calculating usage by tier, use =SUMPRODUCT(구간사용량범위, 단가범위)

Alternative Recipes, Precautions, and Checklist

  • For out-of-range values, return “Not found” or add virtual minimum/maximum boundary rows.
  • Keep tables in ascending order when possible to reduce confusion.
  • [ ] Sorted in ascending order
  • [ ] No missing ranges
  • [ ] Duplicate-boundary handling policy
  • [ ] Verify the -1/1 selection
  • [ ] Apply FLOOR/CEILING
  • [ ] Handle out-of-range exceptions

Troubleshooting

SymptomCauseSolution
Off by one tier at a boundaryIncorrect match_mode selectionSelect -1 or 1 again
Incorrect result for duplicate boundariesDuplicates + default search directionUse search_mode=-1 or remove duplicates
Wrong range returnedIncorrect sortingSort again in ascending order
Many “Not found” resultsOut-of-range values or missing rangesAdd virtual boundaries or correct the ranges
Decimal fluctuationsNo snapping appliedApply FLOOR/CEILING

Conclusion & Recommended Articles

The keys are sorting, continuity, duplicates, and snapping. Use XLOOKUP’s -1/1 options clearly, and use XMATCH+INDEX for transparent management when needed.


Official documentation: XLOOKUP Function, VLOOKUP Function

Leave a Reply

Your email address will not be published. Required fields are marked *