Google-sheets – Find the closest value within a range of cells and output cell reference

google sheetsgoogle-sheets-arrayformulagoogle-sheets-queryvlookup

enter image description here

There are values from F column to AJ column in row 30. My input would be available in C column in row 30. As given in the picture, my input would be 118.45, I would like to find the closest value to 118.45 within the range of cells from column F to AJ.

If we do it manually, I wud get 119.94 which is column U and row 30. Along with the value 119.94, I would like to get the row and column reference (U30). Possible to implement with some multiple functions in google sheet.

Help would be really appreciated.

Best Answer

Presuming you only care about the absolute shortest distance to the entered number, the below should work:

=ADDRESS(ROW(),COLUMN()+
MATCH(ARRAY_CONSTRAIN(
SORT(ArrayFormula({TRANSPOSE(C30:30),ABS(TRANSPOSE(C30:30)-A30)}),2,1),1,1),C30:30,0),4)

The idea is to create a "Table" with the list of values in the first column and the absolute difference in the second column. Sort by the smallest to the largest difference and return the first result.

Use the Match formula to find it in the row, then use Address to find the reference.

enter image description here