Function total(r As Range)
Dim i As Integer
Dim myd As Object
Set myd = CreateObject("Scripting.Dictionary")
total = 0
For i = 1 To r.Rows.Count
If myd.Exists(r.Cells(i, 1).Value) = False Then
myd.Add r.Cells(i, 1).Value, 1
End If
Next i
total = myd.Count
End Function