Hello,
I suggest not to solve this with worksheet functions but to use my UDF
Pfreq:
array-enter into a sufficiently long range with 2 columns:
=Pfreq(Pfreq(A1:A999,B1:B999))
Pfreq you can find he
http://sulprobil.com/html/pfreq.html
Just press ALT + F11 and copy the macro code into a new module.
Regards,
Bernd