+ Reply to Thread
Results 1 to 17 of 17

Dynamically Generating a list

  1. #1
    Registered User
    Join Date
    04-02-2013
    Location
    Ann Arbor
    MS-Off Ver
    Excel 2010
    Posts
    62

    Dynamically Generating a list

    Let me explain, I am trying to auto generate a list. So I have one cell A1 with value "ABC"In another sheet,

    I have a list of products in cells A:1 to A:100 and "ABC" is one of them, but is there 4 times. I have value in B:1 to B: 100

    What I need is to create a list of all the values in Colum B that are related to "ABC"

    Colum A Colum B
    ABC 10
    ABC 20
    ABC Test
    ABC TBD

    Based on "ABC", I need a list to generate a list:
    10
    20
    Test
    TBD

    Thanks in advance. I had try Arrays and VLookup and Match and index but they are all single data returns. I also this to be a dynamic change sence "ABC" will change in the future

    ~j

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Dynamically Generating a list

    Try...

    =IFERROR(INDEX(B:B,SMALL(IF($A$1:$A$100=$E$1,ROW($A$1:$A$100)),ROW(A1))),"")

    Drag down until you get blanks. E1 = ABC

    IMPORTANT
    • This is an array formula
    • Enter the formula >> press F2 then >> CTRL + SHIFT + ENTER
    • If entered correctly, the formula will be enclosed in {brackets}
    • Do not enter the {brackets} manually
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    04-02-2013
    Location
    Ann Arbor
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Dynamically Generating a list

    I try... but it did not work

    B2 is where i have "ABC"

    A10 is where i am entering the code

    Sheet2 A:A is where i am searching for ABC. We have the values 4 times

    Sheet2 B:B is where I am extracting the values from

    ~J

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Dynamically Generating a list

    Based on your description above...

    =IFERROR(INDEX(Sheet2!$B:$B,SMALL(IF(Sheet2!$A$1:$A$100=$B$2,ROW(Sheet2!$A$1:$A$100)),ROW(Sheet2!A1))),"")

    If this does not work again then maybe attach a sample file. Remember, enter as a CSE formula

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamically Generating a list

    Assuming your data is in the range A2:B100.

    Try this array formula** entered in A10:

    =IFERROR(INDEX(Sheet2!B:B,SMALL(IF(Sheet2!A$2:A$100=B$2,ROW(Sheet2!A$2:A$100)),ROWS(A$10:A10))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Dynamically Generating a list

    Hi Tony,

    I see you've used Rows as the k argument for the Small function versus Row.

    I seem to recall you saying you use Rows instead of Row to guard against the deletion of rows? Is this right?

  7. #7
    Registered User
    Join Date
    04-02-2013
    Location
    Ann Arbor
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Dynamically Generating a list

    It kind of works....

    One Issue it picks all the values that are different in Sheet2 B:B


    It is not validating if is actually the same as B5

    So what i am getting is a list of all the different values in sheet2 colum B:B

    Any toughs?

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamically Generating a list

    It accounts for row insertions before the row where the 1st formula is entered.

    It's not 100% "bulletproof" but it's more robust compared to the ROW function.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamically Generating a list

    There's no such thing as:

    It kind of works....
    It either works or it doesn't!

    Ok, give me 10 minutes and I'll post a sample file that demonstrates this.

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Dynamically Generating a list

    Thanks Tony. I have a workbook already prepared...hope that's alright.
    Attached Files Attached Files

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamically Generating a list

    OK, here's the sample file:

    JayReina.xlsx

    Make sure you enter the formula as an array formula.

    Array formulas are entered differently than a regular formula.
    After you type in a regular formula you hit the ENTER key.
    With an array formula you *must* use a combination of keys.
    Those keys are the CTRL key, the SHIFT key and the ENTER key.
    That is, hold down both the CTRL key and the SHIFT key then
    hit the ENTER key.

    When done properly Excel will enclose the formula in squiggly
    brackets { }. You can't just type these brackets in, you
    *must* use the key combo to produce them. Also, anytime
    you edit an array formula it *must* be re-entered as an
    array using the key combo.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamically Generating a list

    Quote Originally Posted by jeffreybrown View Post
    Thanks Tony. I have a workbook already prepared...hope that's alright.
    Ok, I'll butt out!

  13. #13
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Dynamically Generating a list

    No way, I've learned so much from watching your impressive formula work.

  14. #14
    Registered User
    Join Date
    04-02-2013
    Location
    Ann Arbor
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Dynamically Generating a list

    This is great

  15. #15
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamically Generating a list

    I see the "happy face" so we must have made some progress!

  16. #16
    Registered User
    Join Date
    04-02-2013
    Location
    Ann Arbor
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Dynamically Generating a list

    I am having an issue but is not your formula...is that my Excel 2010 is not making it into an Array when I hit CTRL, Shift, Enter... Any blocks that you know?

    But I know it works when I use your file SO thank you Sr.

  17. #17
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Dynamically Generating a list

    Quote Originally Posted by JayReina View Post
    I am having an issue but is not your formula...is that my Excel 2010 is not making it into an Array when I hit CTRL, Shift, Enter...
    If it is not making it into an array and producing a result, can you tell us what it is producing? A blank, value error, wrong result...

+ 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