+ Reply to Thread
Results 1 to 24 of 24

Selecting a table based on drop down list condition

  1. #1
    Registered User
    Join Date
    03-21-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Selecting a table based on drop down list condition

    Hi everyone
    I would like to create the following:
    1. User selects some options from a drop down list.
    2. Based on these options, a particular table is chosen. There may be several tables and ONE of them will be chosen i.e. excel jumps to the worksheet

    Below is a general architecture of what I would like
    http://s17.postimg.org/m3di7sedr/image.png

    I have attached an excel file that contains the drop down list and tables on worksheets 3 and 4.
    Attached Files Attached Files
    Last edited by bos1234; 04-09-2013 at 01:15 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Selecting a table based on drop down list condition

    how do you determine which table is selected? I can see what you have on sheet1, but can find no "link/match" to that on sheet3/4.

    It will make it easier to offer suggestions if you could show us what your expected outcome is (even if you enter it manually) and how you arrived at that?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    03-21-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Selecting a table based on drop down list condition

    thanks for your response. I see what you mean.
    I have attached another excel file.
    First, a user has selected Terrain: Large lake/sea, Antenna configuration: TRDR_TRDR and placement: 1.8/1.8
    These options are linked to sheet 3 as per the small table G1:I2.
    Since these two match, then the big table on sheet 3 (A1:E23) should be copied to Sheet 1.
    Attached Files Attached Files
    Last edited by bos1234; 04-09-2013 at 12:17 AM.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Selecting a table based on drop down list condition

    Im thinking that because your tables are not exactly the same shape/format, it might be easier to "jump" to the required table, rather than tryo to replicate it.

    Is this something you could work with?

  5. #5
    Registered User
    Join Date
    03-21-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Selecting a table based on drop down list condition

    yes I think 'jumping' would be a great idea. Actually, that is better/convenient than copying.
    can it be done sir?

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Selecting a table based on drop down list condition

    Jumping can be done using worksheet function itself but it will becomes hectic approach when the template numbers are more since you are maintaining individual sheets for each templates.

    Please confirm which approach you would like to have VBA solution OR using worksheet functions?


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  7. #7
    Registered User
    Join Date
    03-21-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Selecting a table based on drop down list condition

    worksheet function.
    I am not familiar with VBA yet sir

    thanks for your response

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Selecting a table based on drop down list condition

    Then Please Confirm What will be the maximum Number of Templates you will create in each sheets?

  9. #9
    Registered User
    Join Date
    03-21-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Selecting a table based on drop down list condition

    When you say template do you mean tables?

    Each sheet will contain only 2 tables.
    1st is a criteria table - to link with sheet 1 drop down list
    2nd table is the results

  10. #10
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Selecting a table based on drop down list condition

    Oopss... sorry for asking too many questions... Last question what is the maximum number of sheets you will create?

  11. #11
    Registered User
    Join Date
    03-21-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Selecting a table based on drop down list condition

    thats ok

    Now that is a problem. I am assuming about 10. But this number will increase in the future. Will that be a problem?

    Perhaps more than a hundred worksheets after about a month. As I will continue to have different combinations in the drop down list and subsequently, new tables will be formed.

  12. #12
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Selecting a table based on drop down list condition

    No issues... We go for VBA solution which will work with any Number of sheets. But please ensure that you should keep the condition area in G1 to I2 in each sheet (which you did in sheet3) for identification of the data.

  13. #13
    Registered User
    Join Date
    03-21-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Selecting a table based on drop down list condition

    ok thanks. I Will keep that condition.

  14. #14
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Selecting a table based on drop down list condition

    Copy the below code and Do Right Click On Sheet1 Sheet Tab and select view code and paste the code and return to excel.

    Do Double click on Sheet1-A1 cell which will run the macro based on the selection made in A2,A4,A6 cell.

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    03-29-2013
    Location
    Bangalore/India
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Selecting a table based on drop down list condition

    Wow, this is what i was searching, code is helpful for me, thank you.

  16. #16
    Registered User
    Join Date
    03-21-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Selecting a table based on drop down list condition

    thank you sir it worked perfectly.
    Seems like coding in excel is a very powerful tool!

    Just a quick quesiton:
    What does these two lines do?

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) - code runs only when double clicked?

    If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub -- ??
    Last edited by bos1234; 04-09-2013 at 05:31 PM.

  17. #17
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Selecting a table based on drop down list condition

    Thanks for the assist Six

  18. #18
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Selecting a table based on drop down list condition

    Glad it helps you and thanks for the feedback

    Seems like coding in excel is a very powerful tool!
    Yes, absolutely It's like flying in air

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) - code runs only when double clicked?
    Yes exactly, this is the default worksheet event which will do the given task when double click happens in any of the cell of that worksheet. Refer the attached screenshot to know about remaining available worksheet events.

    Worksheet Event.JPG

    If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub -- ??
    This will run the remaining code when double click happens in A1 cell ALONE, if double click happens in any other cell means then it will end the event

  19. #19
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Selecting a table based on drop down list condition

    Quote Originally Posted by FDibbins View Post
    Thanks for the assist Six
    You're Welcome

  20. #20
    Registered User
    Join Date
    11-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Selecting a table based on drop down list condition

    Dear Sixthsense,

    I have been looking at your input and was wondering how you would solve the problem with worksheet functions assuming a fixed number of tables and format/size?

    Kind regards

    Nudiekap

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

    Re: Selecting a table based on drop down list condition

    nudiekap,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    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]

  22. #22
    Registered User
    Join Date
    11-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Selecting a table based on drop down list condition

    Dear Arlu,

    Thank you for your information and sorry about the violation. I thought it would be OK as long as it was relevant to the earlier posts, as I simply was curious to know the alternative to the VBA solution.

  23. #23
    Registered User
    Join Date
    02-21-2014
    Location
    Durham, NC
    MS-Off Ver
    Excel 2010
    Posts
    1

    Unable to determine if possible to display different tables based on drop-down choice

    I've just tested the code that Sixthsense provided along with the spreadsheet bos1234 provided in the following thread:

    http://www.excelforum.com/excel-gene...condition.html

    It works great: the table appears on Sheet1 when G2 matches A2, H2 matches A4, and I2 matches A6.

    I'm wondering if the macro can be expanded to test for additional matches that would display different tables? For example, could it display a different table if G4 matches A2, H4 matches A4, and I4 matches A6. That would be perfect for what I'm hoping to achieve, which is basically to be able to pick some values from a few different drop-downs and then get only the table that's appropriate to display for that combination of selected values.

    Is this possible?

    Thanks in advance for time and help.
    Last edited by ANewton2965; 02-21-2014 at 05:52 PM. Reason: Request from moderator to change title

  24. #24
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Selecting a table based on drop down list condition

    ANewton, welcome to the forum

    Perhaps you missed post # 21? If so, here is a reminder

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

+ 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