Couting only unique values

I got recently a question on how to count only new values keeping the same counter if the value is repeated.

For example:

Val2 counter a 1 b 2 b 2 c 3


This can be easily achieve by using hashes. Here an example on how this approach could be applied.

HTH
Pedro