Friday 19 February 2016

Near Number From the List of Numbers

Near Number From the List of Numbers




To find the very near value from the list of numbers in a row,
Here, we have array formula
AC3= '{=IFERROR(INDEX($C3:$Y3,MATCH(MIN(ABS($C3:$Y3-$AA3)),ABS($C3:$Y3-$AA3),0)),"")} . For curly brackets , use Ctrl+shift+Enter

If Header , you want to show , just change the Index range with dollar sign(F4) to make it fixed for other cells when you drag down the formula.
AD3 = {=IFERROR(INDEX($C$2:$Y$2,MATCH(MIN(ABS($C3:$Y3-$AA3)),ABS($C3:$Y3-$AA3),0)),"")} . For curly brackets , use Ctrl+shift+Enter

Let's understand the formula here:

Formula: = {=IFERROR(INDEX($C3:$Y3,MATCH(MIN(ABS($C3:$Y3-$AA3)),ABS($C3:$Y3-$AA3),0)),"")}
What we are doing here, 
a) is to get the Difference of every value $C3:$Y3-$AA3. 
b) Converted every difference into all positive value (as difference can be negative too)with ABS function: ABS($C3:$Y3-$AA3).
c) Then, exact Match the minimum value value of above with the range of absolute difference values. MATCH(MIN(ABS($C3:$Y3-$AA3)),ABS($C3:$Y3-$AA3),0))
d) Match will find the position of the value ,  get the value or header with INDEX function
{=IFERROR(INDEX($C3:$Y3,MATCH(MIN(ABS($C3:$Y3-$AA3)),ABS($C3:$Y3-$AA3),0)),"")}

Press Ctrl+shift+Enter for curly brackets as it is array function.

Have a Nice Day!!

No comments:

Post a Comment