+ Reply to Thread
Results 1 to 14 of 14

Finding Sum of Unique Values for Duplicate Values

  1. #1
    Registered User
    Join Date
    03-20-2014
    Location
    Huntsville, AL
    MS-Off Ver
    Excel 2010
    Posts
    3

    Finding Sum of Unique Values for Duplicate Values

    I am trying to find out how to get a sum of unique values for a column of entries that contains duplicate values. In Column A I have a list of Parts Libraries and in Colum B I have a list of Part Numbers. I need two things from this list - a sum of parts for each unique library (which I can achieve with a Pivot table) but I also need a sum of "unique" part numbers for each library. How do I get this value?See screen shot - I entered the Unique Part Numbers column manually to show what information I need help in getting. Thank you in advance for any help!


    3-20-2014 5-07-49 PM.png

  2. #2
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Finding Sum of Unique Values for Duplicate Values

    Hi
    In column c use this helper formula
    =countifs($a$2:a2,a2,$b$2:b2,b2) drag down
    in f2 cell
    =sumifs(C:C,a:a,d2,c:c,1) or countifs(c:c,1,a:a,d2)
    Appreciate the help? CLICK *

  3. #3
    Registered User
    Join Date
    03-20-2014
    Location
    Huntsville, AL
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Finding Sum of Unique Values for Duplicate Values

    AH THAT WORKED!!! Thank you! I have been trying to figure that out for hours! You made my day!

  4. #4
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Finding Sum of Unique Values for Duplicate Values

    You are welcome. If you problem has solved mark thread as solved (in Thread Tools) and you may add reputation below my avatar pic

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Finding Sum of Unique Values for Duplicate Values

    Try this...

    Data Range
    A
    B
    C
    D
    E
    1
    ------
    ------
    ------
    ------
    ------
    2
    Cat1
    1
    Cat1
    3
    3
    Cat1
    1
    Cat2
    2
    4
    Cat1
    2
    Cat3
    3
    5
    Cat1
    2
    6
    Cat1
    4
    7
    Cat1
    4
    8
    Cat1
    4
    9
    Cat2
    3
    10
    Cat2
    3
    11
    Cat2
    4
    12
    Cat3
    2
    13
    Cat3
    2
    14
    Cat3
    4
    15
    Cat3
    5


    This array formula** entered in E2 and copied down:

    =SUM(IF(FREQUENCY(IF(A$2:A$15=D2,B$2:B$15),B$2:B$15),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding Sum of Unique Values for Duplicate Values

    Funny, I just had to solve this problem at work today. The solution I found looks like Tony's.

    AZ-XL, your solution is the hardest to understand, simple formula I have seen. Would you mind explaining the concept?
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  7. #7
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Finding Sum of Unique Values for Duplicate Values

    Quote Originally Posted by Jacc View Post

    AZ-XL, your solution is the hardest to understand, simple formula I have seen. Would you mind explaining the concept?
    Helper column determines unique values by counting them. Values 1 "one" represents unique list. Then sumifs sums all the ones and products.

  8. #8
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding Sum of Unique Values for Duplicate Values

    Yes but the range it's counting is different for each row because of the single $, that is what I have trouble understanding.

    Tony, is the IF(xxx,1) necessary? I tried without and it seems to work fine.

    Sorry for "hijacking" the thread here but I am indeed true to the topic.

  9. #9
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Finding Sum of Unique Values for Duplicate Values

    Quote Originally Posted by Jacc View Post
    Yes but the range it's counting is different for each row because of the single $, that is what I have trouble understanding.
    That is right. If I will select whole column for counting formula will show total number of items. (for example 2 for first item). But I want to differentiate first occurrence with later occurrences. First occurrence will be numbered as 1 and that is what I want.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Finding Sum of Unique Values for Duplicate Values

    Quote Originally Posted by Jacc View Post

    Tony, is the IF(xxx,1) necessary? I tried without and it seems to work fine.
    The outer IF function is testing that the frequencies are <>0. If they are not, then they get evaluated as 1.
    Last edited by Tony Valko; 03-21-2014 at 09:15 AM.

  11. #11
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Finding Sum of Unique Values for Duplicate Values

    Thanks, AZ-XL and Tony! I'm a little bit smarter now.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Finding Sum of Unique Values for Duplicate Values

    Good deal. Thanks for the feedback!

  13. #13
    Registered User
    Join Date
    03-20-2014
    Location
    Huntsville, AL
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Finding Sum of Unique Values for Duplicate Values

    Thank you both AZ-XL and Tony - both solutions work equally well. You are both awesome!

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Finding Sum of Unique Values for Duplicate Values

    You're welcome. Thanks for the feedback!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Find count of Unique or Duplicate Values based on Concatenated values in 2 columns
    By bdicarlo1 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-03-2014, 12:42 AM
  2. [SOLVED] How to turn duplicate values into unique values
    By dco223 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-19-2013, 01:21 AM
  3. [SOLVED] Delete duplicate values and mantening unique values
    By ronald coletto in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 02:19 PM
  4. Help finding and tracking unique duplicate values, append # to name
    By deqx in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-02-2012, 10:46 AM
  5. Handling duplicate values into unique and sum their next column values
    By No_feelings in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-26-2012, 05:12 PM

Tags for this Thread

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