Function RankSales(provin As String, sales As Integer) As Integer
RankSales = 0
'-----------------------------
Dim count As Integer[ATTACH=full]204539[/ATTACH][ATTACH=full]204539[/ATTACH]
Dim ran As Range
Dim FoundCell As Range
Dim FirstAddr As String
'-----------------------------
count = 0
Set ran = Range("$A$4:$A$13")
Set FoundCell = ran.Find(what:=provin)
'------------------------------
If Not FoundCell Is Nothing Then
FirstAddr = FoundCell.Address
End If
Do Until FoundCell Is Nothing
count = count + 1
If Cells(FoundCell.Row, FoundCell.Column + 1) < sales Then
RankSales = RankSales + 1
End If
Set FoundCell = ran.Find(what:=provin, after:=FoundCell)
If FoundCell.Address = FirstAddr Then
Exit Do
End If
Loop
RankSales = count - RankSales
End Function