+ Reply to Thread
Results 1 to 13 of 13

Assemble table in new w/s from rows selected in other w/s

  1. #1
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Assemble table in new w/s from rows selected in other w/s

    Hi All,

    I think this might be a programming issue (not sure but I hope it can be solved).

    I have three sheets, each containing a table. I'd like users to be able toggle or select rows from these tables for inclusion in a fourth table in a new worksheet.

    Unfortunately I have zero knowledge of vba and 0.01 knowledge of macros. I'm attaching a sample of what I'm working with.

    In the attached, the "price list," "likely to reference," and "optional" worksheets contain the source tables; I've added a column to the right of each called "include" (where I'd like a user to be able to select a desired row).

    The "custom" worksheet is where I'd like an assembled worksheet to live.

    If anyone could give me a sense of if this is possible, and how, that would be great.

    Thanks in advance!
    Attached Files Attached Files
    Last edited by prawer; 08-27-2009 at 03:46 PM.

  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: Assemble table in new w/s from rows selected in other w/s

    Have a look, this sheet will assemble itself in realtime on the "custom" sheet. You can put any value at all in column F on the first 3 sheets, it will trigger the "Key" column G as long as the cell isn't blank. The unique index values in the key columns translate to rows in the custom table.
    Attached Files Attached Files
    _________________
    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
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Assemble table in new w/s from rows selected in other w/s

    Cool! I'll tinker with it and mark as solved if everything is OK.

    Thanks!

  4. #4
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Assemble table in new w/s from rows selected in other w/s

    One more question:

    Is it possible to force a certain sort order for the 'service' field in the "custom" sheet?

    That is, not alphabetical, but, for example, Ketchup, then Ground Beef, then Refrigeration?

  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: Assemble table in new w/s from rows selected in other w/s

    I've added in a special new function that doesn't exist in Excel, it's called STRING CONCATENATION. This allows you to do a SUMIF() type analysis of a range of values, but instead of adding when values match, it gathers text strings together and lists them together in a cell.

    The UDF I installed is called CONCATIF().
    http://www.excelforum.com/excel-prog...in-cell.html#2 'explanation


    I also added a new CUSTOM2 sheet that you can use to organize the first CUSTOM sheet into the order you want. Just list the items in column A in the order you wish to see them. The CONCATIF() formulas in the other columns will gather the matching items from CUSTOM sheet and display them altogether.

    I also added a worksheet_activate event to that Custom2 sheet so the rows/columns autofit to display as good as possible each time you look at that sheet.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Assemble table in new w/s from rows selected in other w/s

    Wow, thanks so much!

  7. #7
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Assemble table in new w/s from rows selected in other w/s

    JBeaucaire and all,

    Thank you so much for your help along the way.

    I love the way the 'Service' column looks in the sheet Custom2, but I'm wondering if it's possible to keep services 'grouped' in that way without concatenating the service descriptions? The actual descriptions my company is using are much longer than what I used in my sample, so concatenating them makes it confusing.

    What I'd like, then, is a kind of reversal of the logic that you used, where the service category does not get repeated in several rows, but service sub-descriptions are demarcated by rows.

    Thanks again, and have a great day!

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

    Re: Assemble table in new w/s from rows selected in other w/s

    I chose these solutions each step in an attempt to satisfy your wants in terms of layout and my wants in terms of not creating a sheet that grinds to a snail's pace with array-crunching formulas all over the place. That's typically how these things are accomplished and on larger datasets can be truly unweildy.

    So to get the items back together in an organized way on Custom2 without introducing too-hungry array formulas seemed best accomplished with the UDF we used.

    Now, having CUSTOM or CUSTOM2 organize themselves into a pre-configured list where the list expands/contract on its own, I can't fathom any way without putting those arrays right back in, ugh and more ugh.

    The UDF at least keeps it all in one spot and is evaluated one time and one way, always appearing in the same spot.

    So, the short answer is, yes it probably could be done, but not without some rethinking of everything you've got so far.

    Excel is great at number crunching, but this evaluation of pages of text strings really slows down the plumbing. Perhaps this whole thing would be simpler and more manageable in Access.

    ========EDIT:
    Any chance you'd reconsider this multi-sheet thing and put it altogether in a single "Database" sheet. That would give us back a lot of power and options not having to try and span ordered answers of multiple sheets.
    Last edited by JBeaucaire; 08-25-2009 at 06:45 PM.

  9. #9
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Assemble table in new w/s from rows selected in other w/s

    Appreciate your taking the time to wrestle with this with me.

    I really like the concept of the UDF -- the only issue is that, as I said, our actual descriptions occupy several rows, so the line between any two of them is not quite clear if they're string-concatenated.

    Single-sheet price list should be fine -- I've attached something to that effect (sheet: "Master Price List"). Hope this can make things easier.
    Attached Files Attached Files

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

    Re: Assemble table in new w/s from rows selected in other w/s

    I did all that work taking out those merged cells to give you a parsable data set and now they're all back in again.

    Database = 1 row is a complete and separate data line, it includes all the pertinent information for the record. 1 column represents 1 field. Merged fields are for not for databases.

  11. #11
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Assemble table in new w/s from rows selected in other w/s

    Really sorry JB, I attached the wrong file name. This one has a 'master price list' sheet w/o merged cells, etc.
    Attached Files Attached Files

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

    Re: Assemble table in new w/s from rows selected in other w/s

    This one's almost effortless compared to the other.

    ============
    EDIT:

    On the other hand, switching to this format also opens up the possibility of using an AUTOFILTER. If you turn on the DATA > FILTER > AUTOFILTER and then filter on column A for "x" only, it gives you the same result as the custom sheet, except you don't need the custom sheet to show it.
    Attached Files Attached Files
    Last edited by JBeaucaire; 08-25-2009 at 08:21 PM.

  13. #13
    Registered User
    Join Date
    06-03-2009
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Assemble table in new w/s from rows selected in other w/s

    Thanks JB. It all looks good now.

+ 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