How to find the nearest value to a cell in a column?
I enter a number in cell B1 and I want to find the closest value to it in the column C (C1:C7) and then return it in cell B2. The numbers in column C are unique and they are in ascending order. I tried the "Lookup" function but it is not accurate since it does not return the closest value to B1. I found a way to do this in Excel with the following formula:
INDEX(C1:C7,MATCH(MIN(ABS(C1:C7−B1)),ABS(C1:C7−B1),-))
However, I can not get it to work with Numbers as it only returns the value in C1 regardless of what the value is in B1 (see below, the formula is in cell B2):
What am I doing wrong? Any help is much appreciated.
iMac (27-inch, Late 2012), macOS Sierra (10.12.2)