Could someone please explain how the following works:

=SUMPRODUCT(1/(COUNTIF(A1:A10,A1:A1))

I understand this calculates the number of unique values in a list so if
A1:A5 contains 1 and A6:A10 contains 2 the answer is 2 (items). For example,
I don't understand how COUNTIF works in this situation i.e where the
comparator is an array.

In a recent question, Bob Phillips used SUMPRODUCT to convert an alpha
string e.g. abcde to a numbers (12345) and summed them. Any explanation of
how this works would also be appreciated.

I have looked at the XLD site article on SUMPRODUCT and understand the
basics but these more advanced uses are baffling me!

Many thanks in advance.

John