+ Reply to Thread
Results 1 to 6 of 6

Summing up values in a column corresponding to unique distinct values in another column

Hybrid View

  1. #1
    Registered User
    Join Date
    10-26-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    9

    Summing up values in a column corresponding to unique distinct values in another column

    Hi

    I have two columns in excel, col A and col B.What I would want to achieve is following:

    Col A Col B
    A 2
    A 2
    A 2
    B 3
    B 3
    B 3
    B 3
    C 3
    C 3
    C 3

    Now I want a total of values in column B pertaining to unique (or say 1st occurences) of values in Col A. So in this case the output should be 8 ,Achieved as follows(2 +3+3).

    I have already tried the solution in the following forum http://www.ozgrid.com/forum/showthread.php?t=59420 but it does not work.

    Hope I have made myself clear.Request someone to help.

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Summing up values in a column corresponding to unique distinct values in another colum

    Use this

    Sorry misread the reuirements

    =SUM(VLOOKUP(D2,$A$2:$B$11,2,0),VLOOKUP(D3,$A$2:$B$11,2,0),VLOOKUP(D4,$A$2:$B$11,2,0))

    A
    B
    C
    D
    E
    1
    2
    A
    2
    A
    8
    3
    A
    2
    B
    4
    A
    2
    C
    5
    B
    3
    6
    B
    3
    7
    B
    3
    8
    B
    3
    9
    C
    3
    10
    C
    3
    11
    C
    3
    Last edited by AlKey; 12-24-2013 at 08:17 AM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Summing up values in a column corresponding to unique distinct values in another colum

    Put this formula in C1:

    =IF(A1=A2,"",B1)

    then copy down - it will give you the value for the last occurrence of column A values (assuming they are sorted, as indicated in your example). Then you can just sum column C.

    If you want a single formula, then put this array* formula in C1:

    =SUM(IF(A$1:A$10<>A$2:A$11,B$1:B$10))

    *An array formula needs to be committed using the key combination of Ctrl-Shift-Enter (CSE), rather than the usual <Enter>.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    11-29-2013
    Location
    Pattaya, Thailand
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Summing up values in a column corresponding to unique distinct values in another colum

    You could use the "advanced filter" option and select "copy to another location" and "unique values only"

    On that other location you specify, you simply add up those values that were copied there.

    This is a manual operation though, maybe the other answers suit you better depending on your requirements.

    Cheers,

    Michael.
    Last edited by vayana; 12-24-2013 at 08:32 AM. Reason: other member suggestions

  5. #5
    Registered User
    Join Date
    10-26-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Summing up values in a column corresponding to unique distinct values in another colum

    Thanks to everyone for replying to this thread and wish each one of you a merry christmas and a happy new year ahead.

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Summing up values in a column corresponding to unique distinct values in another colum

    You're welcome. Don't forget to thank those who helped by clicking on Add Reputation * and please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

+ 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. Replies: 7
    Last Post: 01-29-2015, 10:14 AM
  2. Replies: 10
    Last Post: 07-16-2013, 03:19 PM
  3. Count Unique Values In One Column Basis Unique Values in Another Column
    By shez_raz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-07-2012, 01:55 AM
  4. Summing columns based on another column containing unique values.
    By CJPHX in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-14-2010, 02:22 PM
  5. Replies: 2
    Last Post: 11-11-2008, 11:19 AM

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