+ Reply to Thread
Results 1 to 5 of 5

Select a row range from a table; choice of table chosen by a cell value

  1. #1
    Registered User
    Join Date
    07-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    20

    Select a row range from a table; choice of table chosen by a cell value

    Hi guys, I'm new at this and not used to the terminolgy, so please excuse errors! I can just about tackle formulas but suspect VBA is code is needed to solve this problem.

    In a worksheet, the value of cell A4 is determined from a previous operation.

    The value of A4 is between 100 and 200.
    Each value of A4 represents a pricing table, with products along the top and quantity price breaks running down, eg:

    A B C D E F
    1-11 30 40 50 60 70 80
    11-20 29 39 49 59 69 79
    21-30 27 36 46 55 68 77
    31-50 24 33 42 51 66 75
    51+ 21 31 40 50 65 72

    All the 100 pricing 'tables' contain different data. All 'tables' are contained lower down the worksheet.

    The value of another cell, A5, contains the previously determined quantity of product the customer wants to buy (value is in the range 1-50+)

    From the table number (A4) and the quantity (A5) I need to select and paste the relevant row values (the prices of products A-F) into a row, with the first cell at A6.

    eg. if the above pricing table was selected and the custom buys 27 items, the values 27, 36, 46, 55, 68 and 77 would fill cells A6-A11.

    Not being familiar enough with arrays and such like, the solution is beyond me right now. Any help would be hugely appreciated.

    Many thanks indeed

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Select a row range from a table; choice of table chosen by a cell value

    Welcome to the forum.

    Post a workbook with an example.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Select a row range from a table; choice of table chosen by a cell value

    well if you have time!
    restructure your table as shown
    then name all 100 tables
    using insert/name/define
    (do that to view ones ive done)
    then
    use indirect in a vlookup as in yellow cells
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    07-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Select a row range from a table; choice of table chosen by a cell value

    Hi shg, an example worksheet is attached.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Select a row range from a table; choice of table chosen by a cell value

    Hi martindwilson,


    You solution works a treat.

    And renaming the tables won't take nearly as long as spent on this problem up till now!

    Many thanks and much appreciation,
    Julian

+ 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