I have a short row vector (0.0, 1.0, 0.1, 0.9, 0.8, 0.2, 0.3, 0.7, 0.6, 0.4, 0.5) in Excel. I try to pick the index by rank using MATCH on a LARGE argument. The printout indicates it does not work. Could you please comment / help?
Sub rank()
Dim rng As Range
Dim sample As Variant
Dim reference As Single
Dim j As Long
Set rng = Sheets("Sheet1").Range("B3").CurrentRegion
sample = rng.Value
' Debug.Print LBound(sample, 2); UBound(sample, 2)
For j = LBound(sample, 2) To UBound(sample, 2)
Debug.Print j, Application.Large(Application.Index(sample, 1, 0), j), _
Application.Match(Application.Large(Application.Index(sample, 1, 0), j), sample)
Next j
End Sub