Function Problems

Find the Closest Value in Excel with INDEX and MATCH

Nimra MalikNimra Malik Dec 2, 2026 869 views

Question details

Find the value closest to a target in an unsorted range, scaling the target by 1,000 before comparison when needed.

Find the Closest Value in an Unsorted Excel Range
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet target must be compared with values on another sheet without sorting the lookup range.
Observed behavior
The desired result is the closest range value, converted back to the target's units after comparison.
Before you start

Check that the lookup range contains numeric values without blanks or errors, and confirm that its values are in units 1,000 times larger than the target. Identify the target cell and sheet name so you can adjust the formula references.

Solution 1Recommended

Use INDEX and MATCH with Absolute Differences

Find the nearest value without sorting the lookup range.

ABS calculates the distance between the scaled target and each value. MIN finds the smallest distance, and MATCH locates it so INDEX can return the corresponding value.

The final division by 1,000 converts the result back to the target's units. If no scaling is needed, remove both *1000 and /1000.

1
Select the result cell

On the sheet containing the target in E24, select the cell where you want the closest value to appear.

2
Enter the formula

Enter =INDEX('J5-2'!$H$2:$H$1728,MATCH(MIN(ABS(E24*1000-'J5-2'!$H$2:$H$1728)),ABS(E24*1000-'J5-2'!$H$2:$H$1728),0))/1000. Replace E24 and the sheet and range references as needed.

3
Confirm the formula

Press Enter in Microsoft 365 or Excel 2021 and later. In older Excel versions, press Ctrl+Shift+Enter to confirm it as an array formula.

Use INDEX and MATCH with Absolute Differences
Ties return the first match: If two values are equally close to the target, MATCH returns the first one in the lookup range.
Find the nearest value

Find the Closest Value with WPS Spreadsheets

Use the same INDEX and MATCH formula in WPS Spreadsheets to compare a scaled target against an unsorted range and return the nearest value.

  1. 1. Open the workbook: Open WPS Spreadsheets and choose Open to select your Excel workbook.
  2. 2. Check the references: Locate the target cell and the numeric lookup range; in this example, they are E24 and 'J5-2'!$H$2:$H$1728.
  3. 3. Enter the formula: Select a result cell on the target sheet and enter =INDEX('J5-2'!$H$2:$H$1728,MATCH(MIN(ABS(E24*1000-'J5-2'!$H$2:$H$1728)),ABS(E24*1000-'J5-2'!$H$2:$H$1728),0))/1000, adjusting the references if needed.
  4. 4. Confirm and check the result: Press Enter to calculate. If your WPS version requires an array formula, select the formula cell and confirm it with Ctrl+Shift+Enter.
Find the closest value without sorting the lookup rangeOpen and save Microsoft Excel XLSX and XLS filesWork with familiar spreadsheet functions and cell referencesUse a free, easy-to-use spreadsheet application
microsoft office alternative - wps office

Frequently Asked Questions

Why can't I use MATCH with a match type of 1 on an unsorted range?

MATCH with a match type of 1 expects the lookup range to be sorted in ascending order. For an unsorted range, use MATCH with 0 to locate the minimum absolute difference instead.

What happens if two values are equally close to the target?

MATCH returns the position of the first minimum difference, so INDEX returns the first equally close value in the specified range.

Do I need Ctrl+Shift+Enter for this formula?

In older Excel versions, confirm the formula with Ctrl+Shift+Enter. Microsoft 365 and Excel 2021 and later can calculate the array formula with Enter.

How do I use the formula without multiplying by 1,000?

If the target and lookup values use the same units, remove *1000 from both ABS expressions and remove /1000 from the end of the formula.

Can the lookup range contain blanks or text?

Use a numeric range without blanks or errors. Blanks can be treated as zero in the calculations, and text or errors can interfere with the result.