+ Reply to Thread
Results 1 to 7 of 7

Sum values from Range 1 of cooresponding unique values in range 2

  1. #1
    Registered User
    Join Date
    08-13-2012
    Location
    united staes
    MS-Off Ver
    Excel 2003
    Posts
    5

    Sum values from Range 1 of cooresponding unique values in range 2

    Hey guys,

    I am trying to sum the values from range 2 of cooresponding unque values in range 1. If you were to sum all the values in range 2 you would get 30. However, I would like to sum the values in the range, but only the first value of their are duplicate values in rage 2. I dont want it to use the values in range 2 from "AA" twice since there are two "AA" values. Any help is greatly appreciated!

    values to sum.png
    Attached Images Attached Images

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Sum values from Range 1 of cooresponding unique values in range 2

    With your sample data in A1:A10
    Please Login or Register  to view this content.
    This regular formula returns the sum of Col_B values that correspond to the first instance of the Col_A text
    Please Login or Register  to view this content.
    In that example, the formula returns: 21
    (1+0+2+0+3+4+5+6+0=21)

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Sum values from Range 1 of cooresponding unique values in range 2

    @ Ron just for my effort have to post it.

    @dlamin this is with a helper column..

    asample.xls
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  4. #4
    Registered User
    Join Date
    08-13-2012
    Location
    united staes
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Sum values from Range 1 of cooresponding unique values in range 2

    This is awesome! I really appreciate the help on this.

    There is one problem however: If there is a blank cell in the Range 1 column (but there is still a value in Range 2), the entire formula will return a #N/A value. Would you know how to fix it so that it will still count the values in Rage 2 even though there isnt data in range 1?

    Additionally, is it possible to sum the values horizontally? I would like to know the total per value in Range 1 but with the same limitation of the unique value. horizontal.png. Thanks again for all your help!

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Sum values from Range 1 of cooresponding unique values in range 2

    Any chance you could post a workbook? Click "Go Advanced" and click the "manage attachements" button to get started. (png files are a poor substitute.)

    In the meantime...this variation of the formula I posted is durable against blanks
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-13-2012
    Location
    united staes
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Sum values from Range 1 of cooresponding unique values in range 2

    Quote Originally Posted by vlady View Post
    @ Ron just for my effort have to post it.

    @dlamin this is with a helper column..

    Attachment 174056
    vlady. Thank you so much for the helper column. The fomula in the helper column is EXACTLY what I was looking for. I really appreciate your help on this.

    Would you be able to explain to me in layman's terms what this formula actually does? Knowing how the seprate fuctions work together in the forumula would be really helpful for me since it would help me understand in the future how to use it properly. Thank you again so much!

  7. #7
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Sum values from Range 1 of cooresponding unique values in range 2

    Hello

    =IF(COUNTIF($A$2:A2,A2)>1,"",MAX(($A$2:$A$10=A2)*(B2:B10)))

    COUNTIF($A$2:A2,A2)>1 - count if there are duplicate >1
    as you pull it down formula becomes
    COUNTIF($A$2:A3,A3)>1,"" - notice A2:A3 so there is duplicate because the count is greater than 1 then put null/blank ""

    MAX(($A$2:$A$10=A2)*(B2:B10))) get the max or the first value from the countif in column B

    not really good in explaining.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1