A packing table lists each box by the longest item it takes, and almost no item is exactly that long. XLOOKUP's next-larger match finds the first box big enough instead of one that is too small or nothing at all.
You run the packing bench for an online homeware shop. The box sizes are in E2:F5: each box and the longest item it fits, in centimetres. Today's orders are in A2:B7 with each item's longest side. In C2, return the smallest box the item in row 2 fits in, then copy the formula down to C7. An item that is exactly as long as a box still fits it. If an item is longer than every box, show Too big instead, so it can be sent by courier.
Solve it on your own to keep the bonus. Each hint gets one step closer to the formula.
This is the grid you start with. Cell references in the task — B6, C2 — point at the row numbers and column letters below.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Item | Longest side (cm) | Box | Box | Fits up to (cm) | |
| 2 | Candle trio | 12 | Small mailer | 20 | ||
| 3 | Notebook set | 23 | Medium box | 30 | ||
| 4 | Photo frame | 30 | Large box | 45 | ||
| 5 | Wall calendar | 34 | Long box | 60 | ||
| 6 | Desk lamp | 52 | ||||
| 7 | Yoga mat | 68 |
A packing table is written as limits: the medium box takes anything up to 30 cm. The items are measurements, and almost none of them lands exactly on a limit, so an exact-match XLOOKUP(B3,$F$2:$F$5,$E$2:$E$5) looks for 23 among 20, 30, 45 and 60, finds nothing and returns #N/A. What the question means is "the first limit that is not below this item", and that is what a match_mode of 1 asks for: an exact match if there is one, otherwise the next larger value. For the notebook set, 23 has no exact match, the next larger limit is 30, and XLOOKUP returns the Medium box from the same position in E2:E5. The photo frame, at exactly 30 cm, takes the exact match first and also gets the Medium box, which is right, because a limit is a size the box still takes. The direction is the whole point. A match_mode of -1, the next smaller value, is right for price breaks, where a quantity earns the band it has reached, but here it puts the 23 cm notebooks into the 20 cm mailer, which they do not fit. VLOOKUP's approximate match only goes downwards in the same way, so to use it you would have to rewrite the table as lower bounds; XLOOKUP reads the table the way the warehouse wrote it. The yoga mat, at 68 cm, has no larger limit to fall back to, so XLOOKUP returns its fourth argument, Too big, instead of #N/A. That argument has to be there for the fifth to sit in fifth place: leave it empty with two commas and the mat shows #N/A again. The $ signs keep the formula pointing at E2:F5 as it is copied down, and because each answer reads the table, adding a 75 cm box as a new row and extending the ranges moves the yoga mat into a box with no formula rewritten.