+ Reply to Thread
Results 1 to 9 of 9

Pull Information off of database with INDEX, MATCH into a form.

Hybrid View

  1. #1
    Registered User
    Join Date
    03-12-2012
    Location
    Phoenix, Az
    MS-Off Ver
    Excel 2010
    Posts
    4

    Pull Information off of database with INDEX, MATCH into a form.

    Hello.

    I have a database of the following:

    Store Numbers: A
    Name: B
    Title: C

    I would like the information to pull from the database into a form that first locates the store number then returns the information with the highest title first and so on and so on. The title are GM, RM, SS in that order. There can be multiple GM and SS and RM at any store.

    So it would go:
    Store Title Name
    607 GM Smith, Janet
    607 RM Robles, Charles
    607 SS Smith, John


    Store Title Name
    627 GM Durna, Craig
    627 RM Cooper, Karla
    627 RM Michaels, Sarah



    I have an Index formula: IFERROR(INDEX($A$2:$E$5,MATCH($G$1,$A$2:$A$300,0)+1,2),"") That works okay to return the first name if the database is sorted in order of title and name first but it does not if there are more than one store number or they are sorted out of order.

    I searched for something similar and did not find it in the database.

    Thank you in advance for your time.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Pull Information off of database with INDEX, MATCH into a form.

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook. Make sure you have manually mocked up the results your trying to achieve from the available sample data.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    03-12-2012
    Location
    Phoenix, Az
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Pull Information off of database with INDEX, MATCH into a form.

    Test.xlsx

    Here is the file.

    The data is in columns A,B & C and I am sending the results to G and H with the store number to search for in E:1

    Thank you for taking a look at this.

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Pull Information off of database with INDEX, MATCH into a form.

    G2, with CTRL+SHIFT+ENTER, not just enter,

    =IFERROR(INDEX(C:C,SMALL(IF($A$2:$A$100=$E$1,ROW(A$2:A$100)),ROWS(G$2:G2))),"")

    H2, with CTRL+SHIFT+ENTER, not just enter,

    =IFERROR(INDEX(B:B,SMALL(IF($A$2:$A$100=$E$1,ROW(B$2:B$100)),ROWS(H$2:H2))),"")

    Then select both & drag down.

    if you like to use helper column, can possible with just ENTER
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Pull Information off of database with INDEX, MATCH into a form.

    No arrays seem to be required for this.

    First problem... retrieving a random number of rows by any store #.

    F1: =COUNTIF(A:A, E1)
    G2: =IF(ROW(A1)>$F$1, "", INDEX($C:$C, MATCH($E$1,$A:$A, 0)+ROW(A1)-1))
    H2: =IF(G2="", "", INDEX($B:$B, MATCH($E$1,$A:$A, 0)+ROW(A1)-1))

    Copy G2:H2 down 5-10 rows, however many you want.



    Second problem... Getting the list in a specified order

    I think you lucked out on this since the order you listed your Titles happens to be alphabetic. Highlight columns A:C and Sort by 1) Col A ascending 2) Title ascending. Then the formulas above will give the list in the same order they are in the main list.

  6. #6
    Registered User
    Join Date
    03-12-2012
    Location
    Phoenix, Az
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Pull Information off of database with INDEX, MATCH into a form.

    Thank you both for the solutions.

    The issue I encountered with both of these solutions along with my original is they will not work with an unsorted data source list. That is the work around I need along with listing in order of title and then name based on store number.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Pull Information off of database with INDEX, MATCH into a form.

    Sorting the list takes 10 seconds, so I'm not aware of any benefit throwing a lot plumbing at this.

  8. #8
    Registered User
    Join Date
    03-12-2012
    Location
    Phoenix, Az
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Pull Information off of database with INDEX, MATCH into a form.

    Oh I agree entirely it is suepr easy to sort. But my users are..... limited. And as a result I have to work around issues like using common sense to make it "easy".

    I will just write a macro that sorts for me and use the formulas above! Thanks guys.

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Pull Information off of database with INDEX, MATCH into a form.

    You can build your resulting SORT code into a Worksheet_Activate event so each time that sheet is brought up onscreen it is properly sorted automatically.

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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