Dim arr, c, a&
arr = Intersect(Range("a:d"), ActiveSheet.UsedRange)
Set Zd = CreateObject("scripting.dictionary")
For Each c In arr
If c <> "" Then a = Zd(c): Zd(c) = a + 1
Next
[f2].Resize(Zd.Count) = Application.Transpose(Zd.keys)
[g2].Resize(Zd.Count) = Application.Transpose(Zd.items)
End Sub