Which value is nearest a target — the closest price, the nearest size? Find the smallest absolute difference, then return the matching item. No exact match required.
ABS(values−target) is the distance of each; MIN finds the smallest; MATCH locates it; INDEX returns the item. (Array formula.)
The example
Closest standard size to a target of 47.
| A | B | |
|---|---|---|
| 1 | Size | Δ from 47 |
| 2 | 40 | 7 |
| 3 | 45 | 2 |
| 4 | 55 | 8 |
The formula
Nearest value by absolute distance:
How it works
Distance, minimum, then locate:
ABS(values − target)gives each value’s distance from the target.MIN(…)finds the smallest distance.MATCH(min, distances, 0)finds which row has it;INDEXreturns the corresponding item.- In Excel 365 it just works; in older Excel enter it as an array formula (Ctrl+Shift+Enter).
Ties go to the first. If two values are equally close, MATCH returns the earlier one. To always round toward the smaller (or larger) value instead, an XLOOKUP approximate match with mode -1 (or 1) on sorted data is simpler.
Try it: interactive demo
Find the closest standard size.
Variations
Closest distance value
How far off:
XLOOKUP nearest (sorted)
Next smaller/larger:
Closest above only
Ignore smaller values:
Pitfalls & errors
Array entry pre-365. The ABS-based formula is an array formula — press Ctrl+Shift+Enter in Excel 2019 and earlier.
Ties pick the first. Equal distances return the earliest row; decide if that matters.
Blanks skew distance. A blank counts as 0, which may be the “closest” to a small target — clean the data.
Practice workbook
Frequently asked questions
How do I find the closest value to a number in Excel?
How do I get just the nearest value (not the item)?
What happens with ties?
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