+ Reply to Thread
Results 1 to 4 of 4

Aggregating rows based on unique ID

  1. #1
    Registered User
    Join Date
    03-25-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    20

    Aggregating rows based on unique ID

    Hi all,

    I have data in the form;

    Paul 23
    Paul 24
    Rob 37
    susie 33

    Where I need a third colum which sums up each persons column two entries into one cell. so;

    Paul 23
    Paul 24 47
    Rob 37 37
    susie 33 33

    Thanks in advance,

    PJ
    Last edited by TWDC; 06-11-2011 at 06:22 PM.

  2. #2
    Registered User
    Join Date
    06-08-2011
    Location
    Orlando, Florida
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Aggregating rows based on unique ID

    Assume that you have a range for your Column A Names that is A1:A4
    The range for Column B numbers would be B1:B4
    In the third column, you use a SUMIF function.
    Next to the first name, Paul, in C1 would be the forumla =SUMIF(A1:A4,A1,B1:B4)
    You could copy this formula to cells C2:C4 if you add the $ signs to hold the ranges constant.
    =SUMIF(A$1:A$4,A1,B$1:B:$4)

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Aggregating rows based on unique ID

    If the names are grouped together as sample, then assuming data starts in A2 and B2, then in C2 enter:

    =IF(A2=A3,"",SUMIF(A$2:A2,A2,B$2:B2))

    copied down.

    Else if names are mixed up and duplicates are not grouped try:

    =IF(COUNTIF(A$2:A2,A2)=COUNTIF(A:A,A2),SUMIF(A:A,A2,B:B),"")
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    03-25-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Aggregating rows based on unique ID

    amazing thanks both

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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