+ Reply to Thread
Results 1 to 17 of 17

Extracting sublist from list based on criteria

  1. #1
    Registered User
    Join Date
    06-21-2012
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    11

    Extracting sublist from list based on criteria

    Hi,

    I have a table such that column A has a list of names, column B shows either "Yes" or "No" depending on if that person's info needs updating. I am trying to find a way to a populate a list (prefereably in column C) that has only the names of people from column a that show a yes in column b.

    I know that i could just do =if(B2 = "Yes", A2, "") and then drag the formula down, but that leaves blanks in between the cells. If column A has 10 names and only 3 are Yes then I only want the first 3 cells in column C to be populated with the corresponding names.

    I think I need to use a combination of INDEX and MATCH functions but i dont know how to do that with a criteria that falls in another column.

    Any help is greatly appreciated

    thanks!

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

    Re: Extracting sublist from list based on criteria

    =IFERROR(INDEX($A$2:$A$100,SMALL(IF($B$2:$B$100="Yes",ROW($A$2:$A$100)-ROW($A$2)+1),ROWS($A$2:$A2))),"")

    Confirmed with CTRL+SHIFT+ENTER not just ENTER and copied down.... First adjust ranges to suit.
    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: Extracting sublist from list based on criteria

    You get better help if you post an Excel-example of your workbook, without confidential information.

    Make sure the workbook demonstrates your desired results if possible, or just highlight the cells you're trying to fix.

    Use BEFORE/AFTER sheets if that helps make it clearer.
    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-21-2012
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Extracting sublist from list based on criteria

    see below...
    Last edited by frichmond; 06-27-2012 at 08:20 PM.

  5. #5
    Registered User
    Join Date
    06-21-2012
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Extracting sublist from list based on criteria

    Thanks for the help so far. With the solution NBVC gave i only get the first instance of a name and a "yes" repeated over the whole range. (maybe there is a problem with my implementation but maybe not) here is what i get with the previously posted solution (sorry about the formatting issues)


    Name --Needs Change -- Changes Required For:
    Bob ----Yes--------------Bob
    Frank --No ---------------Bob
    John ---Yes--------------Bob
    Jerry ---No-------------- Bob
    Jim ---- Yes--------------Bob


    and here is what i would like

    Name --Needs Change -- Changes Required For:
    Bob ----Yes--------------Bob
    Frank --No ---------------John
    John ---Yes--------------Jim
    Jerry ---No-------------- ######<-- ideally from here on would be blank
    Jim ----Yes--------------

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

    Re: Extracting sublist from list based on criteria

    Did you confirm the formula with the CTRL +SHIFT + ENTER keys?

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

    Re: Extracting sublist from list based on criteria

    See attached.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-21-2012
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Extracting sublist from list based on criteria

    thank you so much!

    could you explain why the ctrl + shift + enter works?

    what i was doing before was selecting the entire range and then pressing ctrl + shift + enter (similar to the transpose function) so that was why i was only getting the first entry repeated. but why does it work to confirm the function with just the first cell in the range and then drag it down?

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

    Re: Extracting sublist from list based on criteria

    See here for more explanation:

    http://www.cpearson.com/excel/ArrayFormulas.aspx

    also Google for "Array Formulas" for even more material.

  10. #10
    Registered User
    Join Date
    08-07-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Extracting sublist from list based on criteria

    Quote Originally Posted by NBVC View Post
    =IFERROR(INDEX($A$2:$A$100,SMALL(IF($B$2:$B$100="Yes",ROW($A$2:$A$100)-ROW($A$2)+1),ROWS($A$2:$A2))),"")

    Confirmed with CTRL+SHIFT+ENTER not just ENTER and copied down.... First adjust ranges to suit.
    NBVC, thanks for this formula. I could use your help on a related task. I'm tring to setup a budget spreadsheet that has a main page for all transactions and monthly pages that get automatically updated to reflect transactions from that month. I tried adjusting your formula to fit and work with my spreadsheet but I can't seem to get it to work.

    The best I could do was getting the correct dates and values to copy over but only at the rows that the transactions were entered in on the main sheet (see attachment).

    Could you give some help? Thanks!Budget.xls

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

    Re: Extracting sublist from list based on criteria

    Afraid you need to start your own thread.. you can reference this one if you lke.

  12. #12
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Extracting sublist from list based on criteria

    Hello rossmon, and welcome to the forum.

    Unfortunately you have inadvertently broken one of the forum rules. Please read the following and make the necessary change. Thanks.

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

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

    Re: Extracting sublist from list based on criteria

    Not sure why you need to post this, if he/she is already told to start their own thread Advise doesn't need to come only from moderators.

  14. #14
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Extracting sublist from list based on criteria

    I thought it best to point out to a new member that it wasn't simply advice but, rather, a forum rule.

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

    Re: Extracting sublist from list based on criteria

    They have to/should read the rules when registering, so my advice was a reminder of the rules (indirectly)...

  16. #16
    Forum Contributor
    Join Date
    06-28-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    115

    Re: Extracting sublist from list based on criteria

    Hi sorry I know this is old post but what if have 3rd column C and it has timestamp.

    so if it is b is NO then extract all in column A
    if column B is yes then only extract one which is Yes.

    Please see this image.
    9806704853_59698497c7_o.png

  17. #17
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Extracting sublist from list based on criteria

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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