0

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?

2 Answers 2

2

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

2
  • Thanks. This will get me where I need to be. I had hoped that I could create a function that sums the data in place, without the addition of a new column, but this will do. For future reference, I did have to make a slight modification to your function: =IF(COUNTIF($A$1:A1,A1)=1,B1,"") Apr 20, 2010 at 13:43
  • @Todd: You can hide the new column, but still get the sum of the hidden column.
    – Leftium
    Apr 20, 2010 at 20:16
2

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.
1
  • Thanks, but I don't want to modify or hide the existing data. Highlighting gets me nowhere when it comes to calculating a sum either. Apr 20, 2010 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .