You can use a quick Visual Basic function to do
this:
Function Nearest(Bit As Double, Stuff As Range)
Application.Volatile
BitRank = Application.WorksheetFunction.Rank(Bit, Stuff)
If BitRank + 1 > Stuff.Count Then
Nearest = Application.WorksheetFunction.Large(Stuff, BitRank - 1)
ElseIf BitRank = 1 Then
Nearest = Application.WorksheetFunction.Large(Stuff, 2)
Else
NearBelow = Application.WorksheetFunction.Large(Stuff, BitRank - 1)
NearAbove = Application.WorksheetFunction.Large(Stuff, BitRank + 1)
If Abs(NearBelow - Bit) < Abs(NearAbove - Bit) Then
Nearest = NearBelow
Else
Nearest = NearAbove
End If
End If
End Function
Say the range is called TestRange, from B1 to B10.
You can call the function as follows:
=nearest(b2,TestRange)
This will give the nearest neighbor to B2
among the other entries. It will only return
the same value as B2 if there are 2 or more
entries with that same value.