Well, here's what I suggest, especially if your array of 15 is sorted. Psuedo code follows:
Code:
For Nr = 1 To 5
lBestMatchIndex = 0
For X = 1 To UBound(arrayOf15)
If Abs(flexGridNr(Nr) - arrayOf15(X)) < Abs(flexGridNr(Nr) - arrayOf15(lBestMatchIndex)) Then
lBestMatchIndex = X
End If
Next
' now you have the best match, you can compare it to the one above to see if they are same difference
If lBestMatchIndex = UBound(arrayOf15) Then ' no comparison needed
Debug.Print "Best Match for "; Nr; " is "; arrayOf15(lBestMatchIndex)
ElseIf Abs(flexGridNr(Nr) - arrayOf15(lBestMatchIndex)) = Abs(flexGridNr(Nr) - arrayOf15(lBestMatchIndex + 1)) Then
' number high & low have same difference
Debug.Print "Best Match for "; Nr; " is "; arrayOf15(lBestMatchIndex ); " and "; arrayOf15(lBestMatchIndex + 1)
Else
Debug.Print "Best Match for "; Nr; " is "; arrayOf15(lBestMatchIndex)
End IF
Next
Edited: fixed some typos with lBestMatchIndex. Anyway, I think you can follow the logic; and that's the main purpose of pseudo code