Hey everyone,
Thanks for your input. Your UDF seems to work very well but really what I'd like to be able to do is search the data set for the nearest neighboring cells and display their (x & y coordinates). My idea was to use a UDF similar to vlookup to look up every value for a given frame number and then return the values that fall with in a given criteria (for example within 20 units of x). I've updated my workbook with a better of idea of the formatting I'd like to display. Also I'll include my current UDF to find all values based off frame. As always feel free to ask questions. I think the easiest way to resolve this is just with IF statements but I'm not sure it may require too many for one statement.
Here is the UDF I was thinking of using:
Function VlookupAll(sSearch As String, rRange As Range, _
Optional lLookupCol As Long = 2, Optional sDel As String = ",") As String
Dim i As Long, sTemp As String
If lLookupCol > rRange.Columns.Count Or sSearch = "" Or _
(lLookupCol < 0 And rRange.Columns.Count > 1) Then
VlookupAll = CVErr(xlErrValue)
Exit Function
End If
VlookupAll = ""
For i = 1 To rRange.Rows.Count
If rRange(i, 1).Text = sSearch Then
If lLookupCol >= 0 Then
VlookupAll = VlookupAll & sTemp & rRange(i, lLookupCol).Text
Else
VlookupAll = VlookupAll & sTemp & rRange(i).Offset(0, lLookupCol).Text
End If
sTemp = sDel
End If
Next i
End Function
Bookmarks