Shipping costs by weight and zone, a tax rate by income and status, pricing by quantity and tier — these need a two-way lookup that lands in the right band on both axes. INDEX with two approximate MATCHes does it on a sorted grid.
MATCH(…, 1) finds the largest breakpoint not exceeding the value — the correct band — on each axis.
The example
Shipping cost by weight (rows) and zone breakpoints (cols). Look up 7 lb, zone-distance 250.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Wt \ Dist | 0 | 200 | 400 |
| 2 | 0 | $5 | $7 | $9 |
| 3 | 5 | $8 | $11 | $14 |
| 4 | 10 | $12 | $16 | $20 |
The formula
The rate for 7 lb at distance 250 (falls in the 5-lb row, 200-distance column):
How it works
Approximate MATCH on each axis finds the band:
MATCH(7, A2:A4, 1)with type1finds the largest weight breakpoint not over 7 — the 5-lb row (position 2).MATCH(250, B1:D1, 1)does the same across the top — the 200 column (position 2).INDEX(B2:D4, 2, 2)returns the cell at that row/column band —$11.- Both axes must be sorted ascending for approximate MATCH to band correctly.
Sorting is mandatory here. Approximate MATCH (type 1) assumes the breakpoints ascend. On unsorted axes it returns the wrong band with no error — the classic silent mistake. Sort both the row and column headers.
Try it: interactive demo
Set a weight and distance; see which band the grid lands on.
Variations
Exact two-way (labels)
Use MATCH type 0 for exact row/column labels:
Nested XLOOKUP approximate
Excel 365, match_mode -1 on each axis:
One axis exact, one approximate
Mix MATCH types — e.g. exact zone, banded weight.
Pitfalls & errors
Unsorted axes = wrong band, no error. Approximate MATCH needs both header axes sorted ascending. This is the #1 cause of silently wrong rates.
Below the first breakpoint. A value smaller than the first row/column breakpoint returns #N/A. Start each axis at 0 (or the minimum) to cover everything.
Breakpoints are “at least.” Each band means “this breakpoint up to the next.” Make sure your grid’s headers represent the lower edge of each band.
Practice workbook
Frequently asked questions
How do I do a two-way lookup that finds the right band on both axes?
Why is my rate-grid lookup returning the wrong value?
How do I do this with XLOOKUP?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class