
Originally Posted by
olives
Ok, we're almost there... I've attached an example file, maybe what I want is clearer in the attached spreadsheet than what I wrote.... Thanks!
Sorry, I don't know why, but I misread your original message to ask for the smallest values from Column C, but it is obvious that you did in fact ask for the highest values. Replace the code I gave you earlier with this...
Code:
Function Largest(Number As Long) As Variant
Dim X As Long, Index As Long, TestValue As Variant, Source As Variant, Results As Variant
Source = Range("B1:C" & Cells(Rows.Count, "B").End(xlUp).Row)
ReDim Results(1 To UBound(Source), 1 To 1)
TestValue = Range("A1").Value
For X = 1 To UBound(Source)
If Source(X, 1) < TestValue Then
Index = Index + 1
Results(Index, 1) = Source(X, 2)
End If
Next
Largest = WorksheetFunction.Large(Results, Number)
End Function
And then use this formula in A2 on down...
=Largest(ROW(A1))
Bookmarks