+ Reply to Thread
Results 1 to 7 of 7

Creating a list from two columns without gaps

  1. #1
    Registered User
    Join Date
    11-14-2012
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    2

    Creating a list from two columns without gaps

    I have used the below array formula before to get all ID=8 in a separate list but now I have a new problem that I hope can be solved in a similar way but I cannot really figure out how..

    Array formula used to get all rows with ID=8 in a new list without gaps.
    =INDEX(ID,SMALL(IF(ID=8,ROW(ID)-ROW($A$1)+1),ROWS(AF$28:AF28)))

    Now I have the following sheet:

    In column A i have all ID:s
    In column B i have an argument, YES or NO.

    What I want to do is to get a list of all ID:s in column A that are marked with YES in a new list without any gaps. How can I do this? As column B can change quite a lot I want this as an array formula so it automatically updates the new list.

    The list of ID:s are around 600 rows if that matters.

    Thanks for your help!

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Creating a list from two columns without gaps

    Try this Array formula

    =IFERRORINDEX($A$2:$A$1000,SMALL(IF($B$2:$B$1000="YES",ROW(A$2:$A$1000)-1,ROW(A1))),"")
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Creating a list from two columns without gaps

    An array formula
    =SMALL(IF($B$1:$B$25="YES",$A$1:$A$25),ROW(A1))
    A=columns ID
    B columns Yes no

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Creating a list from two columns without gaps

    @ eisayew

    Pls notice that usually the ID's are not only numbers.

  5. #5
    Registered User
    Join Date
    11-14-2012
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Creating a list from two columns without gaps

    Thank you so much Fotis1991! I think it was a small error in your array formula but I got it sorted, below is the one i finally used:

    =IFERROR(INDEX($A$2:$A$1000,SMALL(IF($B$2:$B$1000="YES",ROW(A$2:$A$1000)-1),ROW(A1))),"")

    Again, huge thanks! Didn't really get my head around this when I was trying to figure it out, nice to have this forum to fall back on!

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Creating a list from two columns without gaps

    You are welcome.

    Yes i missed a paranthesis! after -1 Nice that you found this.

  7. #7
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Creating a list from two columns without gaps

    You are right, I should use Index-match with small function. Thank you

+ 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