+ Reply to Thread
Results 1 to 7 of 7

Pulling multiple results from one column that correspond to a second column

  1. #1
    Registered User
    Join Date
    06-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    3

    Question Pulling multiple results from one column that correspond to a second column

    Hi There! I have been poking around, but the best answer I can find is a vlookup and an if function, but they don't seem to be working.

    Take the following:
    A B C
    Jim 5 2010
    Jim 5 2010
    Jim 6 2010
    Jim 7 2013
    Aaron 5 2009
    Aaron 7 2009
    Sara 6 2010
    Sara 6 2013

    How could I set up sheets of data (one for each year 2009-2013) where the cells in the first row will say a name and the combined total of column b for that year? For instance, the 2010 sheet would show:

    A B
    Jim 16
    Sara 6

    the 2009:
    A B
    Aaron 12

    I have summed two v lookups (using true and then false) but that will only give me the first and last data point, so for instance in 2010 Jim would=11. I also have hundreds of rows of data. Please help if you can, it would be greatly appreciated!

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

    Re: Pulling multiple results from one column that correspond to a second column

    See attached.

    In Sheet 1 use a couple of helper columns.

    So assuming your data occupies column A:C, then in D2:

    =IF(COUNTIFS(A$2:A2,A2,C$2:C2,C2)=1,A2,"")

    copied down

    in E2:

    =IF(D2="","",C2&"_"&COUNTIFS(C$2:C2,C2,D$2:D2,"?*"))

    copied down

    Then assuming the years are in A1 of each sheet,

    Select all sheets (select first annual sheet, hold Shift key, select last sheet)

    Then enter formula in first cell for you summary:

    =IFERROR(INDEX(Sheet1!A:A,MATCH($A$1&"_"&ROWS($A$2:$A2),Sheet1!$E:$E,0)),"")

    copied down as far as you need to get all info

    in adjacent cell, assuming you put that in A2:

    =IF(A2="","",SUMIFS(Sheet1!$B:$B,Sheet1!A:A,A2,Sheet1!C:C,$A$1))

    copied down.

    Now you can right-click a tab and ungroup.
    Attached Files Attached Files
    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.

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Pulling multiple results from one column that correspond to a second column

    And I used the workbook of NBVC (thank you for that) to make a pivot table.

    See the example.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Registered User
    Join Date
    06-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: Pulling multiple results from one column that correspond to a second column

    Hey NBVC,

    Thanks for your suggestions, but I'm not sure those functions work. In the workbook you have attached, the info for the 2009 and 2010 sheets does not correspond to the data on the first sheet. I also tried to apply your functions to my data, but it doesn't really seem to work for hundreds of rows of data. Any suggestions on how I might change it? Thanks so much for all of your help!

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

    Re: Pulling multiple results from one column that correspond to a second column

    In A1 of the 2009 sheet, just change 2010 to 2009...

    If still you have an issue, attach a sample of your own that I can apply formulas, etc to.

  6. #6
    Registered User
    Join Date
    06-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: Pulling multiple results from one column that correspond to a second column

    It was my mistake-the names weren't in order and so the functions weren't working. Thanks so much for your help!

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

    Re: Pulling multiple results from one column that correspond to a second column

    Ok Great.. and you're welcome

    Can you please remember to mark your thread as SOLVED?

    Thanks.

+ 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