Google-sheets – Compare number in one cell to multiple cells and give out nearest number

formulasgoogle sheets

https://docs.google.com/spreadsheets/d/1Dew-CLxHvMW2BgI9axdJTEI-2CezTx7k6Vt1R48mwgA/edit?usp=sharing

Above is the sample sheet. I need a formula in K cell

enter image description here

Best Answer

You can use the following formulas

Closest minimum value

=MINIFS(A2:E2, A2:E2, ">=" & G2)

Closest maximum value

=MAXIFS(A2:E2, A2:E2, "<=" & G2)

enter image description here

Functions used: