Sub xyf()
Dim result()
Dim arr()
maxban = 100
arr = Range("f1:f20")
arrconut = UBound(arr)
result(1) = arr(1)
For i = 1 To arrconut Step 1
fban = arr(i)
sban = arr(i + 1)
If fban <> sban Then
result(i + 1) = sban
End If
If fban = sban Then
maxban = maxban + 1
result(i + 1) = maxban
End If
Next
Range("A1:A20") = Application.WorksheetFunction.Transpose(result)
End Sub