I am looking for a formula that given a condition in one column, sums all the unique values from another column.

SUMIF only takes me half way, as I still need to sum the unique values. If I could invent functions, I guess I would be looking for something like:
SUM.UNIQUE.IF(Range to look, Criteria, Range to sum unique values)

Here's some example data:

sumif_unique_values.xlsx

Product GlobalSum
PT1 2
PT2 4
PT1 2
PT2 4
PT3 4
PT1 3
PT2 5
PT3 3
PT1 3
PT2 5
PT1 3
PT2 5

Expected results from example data:
Sum all unique values in column B (GlobalSum) for Product 1 (PT1) = 2+3 = 5
Sum all unique values in column B (GlobalSum) for Product 2 (PT2)= 4+5 = 9

I tried the solution on another post that seemed to describe my problem, but it didn't work… Here's the code sugested on that post:

=SUM(IF(ISNUMBER(1/FREQUENCY(IF(B2:B13<>"",IF(A2:A13<>"",MATCH(A2:A13,A2:A13,0))),ROW(A2:A13)-ROW(A2)+1)),B2:B13))

Many thanks on advance for all your help.

Cheers, hmpw