Excel Sum that excludes duplicates

I have data in the following format:

Id    Value
------------
1     20
2     40
3     20
3     20
4     50

I want to sum the value column while excluding duplicates from the id column. In this case, I should end up with a total of 130. Can anyone help?


You can create a new column with duplicates removed; SUM() the new column.

Use the COUNTIF() function to reduce values for duplicate ID's to 0 in the new column like this:

=IF(COUNTIF($A$1:A1,A1)=1,B1,"")

(example above assumes ID's are stored in column A, and their values are stored in column B)

source and more detailed info


From Microsoft: Filter for unique values or remove duplicate values

  • To filter for unique values, use the Advanced command in the Sort & Filter group on the Data tab.
  • To remove duplicate values, use the Remove Duplicates command in the Data Tools group on the Data tab.
  • To highlight unique or duplicate values, use the Conditional Formatting command in the Style group on the Home tab.