Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    67

    Unanswered: Summing duplicate values

    Hi Pls help. I am trying to write a sum function which compares values down a column and then adds values from another column if there are more than one. The formula I wrote works for 2 identical values but not for more than that. I'll copy my formula to make it clearer:

    =IF(A2=A3, A2+A3, "").

    This works if A2 and A3 are duplicated but does not work if there are more than 2. How can I get round this? Does anyone know how I can write it in VBA if it can't be done as a pure function?

  2. #2
    Join Date
    Feb 2006
    Posts
    113
    Tasha,

    The requirement is not at all clear to me - and, the example is not consistent with the description (doesn't refer to a different column).

    Please post again with a clearer description and a better example.

    regards,
    Fazza

  3. #3
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    Quote Originally Posted by tasha123
    Hi Pls help. I am trying to write a sum function which compares values down a column and then adds values from another column if there are more than one. The formula I wrote works for 2 identical values but not for more than that. I'll copy my formula to make it clearer:

    =IF(A2=A3, A2+A3, "").

    This works if A2 and A3 are duplicated but does not work if there are more than 2. How can I get round this? Does anyone know how I can write it in VBA if it can't be done as a pure function?
    is it something like this you are after (this is just a guess at what is required)

    =SUMPRODUCT(--($A$2:$A$13=$A2)*($B$2:$B$13))

    give it a try and see if it does what you need if not as fazza sed youll need to be clearer

    All the Best
    Dave

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •