I can't clearly see what you need to do ...

1/. Which column is the unique value column you need to count?

2/. Which column is the one you need to sum?

3/. What is the 1% situation not covered by the various solutions I offered?