Option Explicit
Sub dem()
Dim lr&, i&, rng, dic As Object, key
Set dic = CreateObject("Scripting.Dictionary")
lr = Cells(Rows.Count, "A").End(xlUp).Row
rng = Range("A1:B" & lr).Value
For i = 1 To UBound(rng)
If Not dic.exists(rng(i, 1)) And Not IsEmpty(rng(i, 1)) Then
dic.Add rng(i, 1), 1
Else
dic(rng(i, 1)) = dic(rng(i, 1)) + 1
End If
Next
For i = 1 To UBound(rng)
For Each key In dic.keys
If key = rng(i, 1) Then
rng(i, 2) = dic(key)
Exit For
End If
Next
Next
Range("A1:B" & lr).Value = rng
End Sub