+ Reply to Thread
Results 1 to 4 of 4

Best way to OUTPUT/COPY selected rows and all columns from a dynamic table

  1. #1
    Registered User
    Join Date
    05-06-2019
    Location
    Long Island, NY
    MS-Off Ver
    2016
    Posts
    2

    Question Best way to OUTPUT/COPY selected rows and all columns from a dynamic table

    Hi,

    I need help determining the best way to extract rows from an Excel r x c matrix with all columns extracted and the rows extracted according to a text value that might appear in any, but only one of the array columns.

    I am pretty sure I could do it with some combination of LOOKUP, INDEX and MATCH. The only problem I see here is that the r x c matrix steadily increases in size over time, especially the number of rows. I want to automate my analysis as much as possible.

    I wonder if I could use either a pivot table or the Power Query function for my recurring analysis. I have tried using a pivot table, but without success. As for the Power Query, it seems to only reduce a database in size by, in my case, removing rows. Instead, I want to copy/extract rows from my r x c matrix to another area of my workbook. I do not want to change the r x c matrix in any way.

    Here is my issue

    What I want to do: extract from a matrix all rows and all the columns where any column for any row has a specified textual value.

    The matrix/table

    1. The matrix: no more than twenty columns and over time will expand to rows numbering in triple figures
    2. All values are text
    3. Each matrix cell has only one text value.
    4. Some of the cells in the matrix are blank, but I can I fill these with null characters (e.g. “”) if needed.
    5. The text values in each are unique to that row i.e. rows contain no duplicates
    6. However, columns will contain duplicates, but these duplicates will not be in the same column down rows. For example, ‘John’ may appear in r2c4, r4c6, r8c4 and r10c12. However, ‘John’ will never appear more than once in the same row.
    7. These duplicates do not need removing from the matrix

    The analysis/expected result/output

    The result should be a reduced version of the original r x c matrix. This reduced matrix will have fewer rows, but the same number of columns as the original matrix. It should be placed in another part of the Excel workbook

    1. For example: My matrix is 20 rows by 12 columns and the text value ‘John’ appears in cells r2c4, r4c6, r8c4 and r10c12. I want to extract rows 2, 4, 8 and 10 and all twelve (12) columns because my filter is ‘John’.
    2. The constraints are as follows:
    a. The number of columns and rows in the matrix will expand over time (the matrix is tags extracted from Zotero, a citation/note taking software program).
    b. There is only one tag in each matrix cell
    c. Some matrix cells will not have a tag, but can have a filler value (“” or N/A) as needed.
    d. The row selection value/filter (‘John’ in the above example in 1.) will be different every time I query the matrix. I want to have this filter in a named cell and be able to enter it automatically. I assume the best way to do this would be i) a macro ii) VBA code. Ultimately, I hope to automate the input, formatting, and outputting of my Zotero tags in Excel with macros/VBA code.
    e. I want to automate this matrix querying as much as possible.

    I am seeking advice on the best and most economical way of accomplishing this in Excel. I want to minimize my own input (copying ranges, changing formulas, manual sorts). Ideally, I want to do nothing more than enter the filter text value.

    My thanks in advance for your advice and suggestions.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Best way to OUTPUT/COPY selected rows and all columns from a dynamic table

    Hundreads of views and no replies.

    The problem is that it's nigh-on impossible to visualise all tose words.

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please don't attach a picture of an Excel sheet (no-one will want to re-type all your stuff before starting).

    1. It does NOT have to be your real sheet - mock up a SAMPLE if you need to. But not 1000's of rows!!! It makes manual checking so tedious. Whatever you do... make sure that all confidential information is removed first!!

    2. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    3. Make sure that your desired solution is also shown (mock up the results manually).

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    05-06-2019
    Location
    Long Island, NY
    MS-Off Ver
    2016
    Posts
    2

    Smile Re: Best way to OUTPUT/COPY selected rows and all columns from a dynamic table

    Dear Glenn

    Apologies for my verbosity. I was trying to make my problem very clear, but obviously failed.

    As you requested:
    1. Attached are the relevant worksheets from my current workbook. I am sending you real data, not a sample.
    2. The table/array I am seeking help with presently has 31 rows by 13 columns
    3. In time it may grow to over a thousand rows. The number of columns, however, will increase by only a hand full. I doubt if I will have more than 20 columns.
    4. My database contains the tags I add to the citations and notes I record in Zotero, a citation/note taking program. The longer and more extensively I research, the more citations and notes I will be adding to my database. The number of tags (rows) will increase in tandem
    5. I have tried to, as you requested, to collapse all the merged cells. I don't think I have missed any. Apologies if I have.
    6. Each worksheet has comments in red font explaining the data and how they were input/created.

    I thank you most kindly for your offer of help and well-taken advice on how to ask for help.

    I hope the attached workbook is more comprehensible than my original post.

    If you have any questions, please contact me.

    Thanks again for you help.

    I look forward to hearing your suggestions and comments.

    Sincerely,

    Graham

    P.S. I followed your directions regarding attaching the Workbook. Let me know if it didn't work and I'll try again.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Best way to OUTPUT/COPY selected rows and all columns from a dynamic table

    Not claiming it to be the best, however below is a description of a method that automates the process and eliminates the 'transpose' table as I assume that the desired product is to get a count of tags in columns that include 'soccoop'.
    Sheet 1 is the source data, which is shifted over one column so that the filter value and COUNTIFS formula may be permanently placed in column A.
    Sheet 2 is populated using: =IFERROR(INDEX(Sheet1!C$3:C$2000,AGGREGATE(15,6,(ROW($A$3:$A$2000)-ROW($A$2))/(Sheet1!$A$3:$A$2000>0)/(ISTEXT(Sheet1!C$3:C$2000)),ROWS($A$1:$A1))),"")
    Sheet 3 column A is populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    A Pivot table is then produced from that list, employing the Tags as both the row labels and values (count).
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Copy across 9 columns of source data into 9 columns of an output table
    By nunez100 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-29-2019, 10:19 AM
  2. [SOLVED] table(A) as an array using all rows but only selected columns to compare with table(B)
    By se3unlock in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-27-2015, 10:15 AM
  3. Getting an output of multiple columns with averages of selected number of rows of column B
    By venkatkaushik in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-27-2015, 09:20 AM
  4. Copy data from selected columns into one rows in another sheet
    By cheeklyn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-24-2015, 05:36 AM
  5. VBA Copy from Excel to Word Selected Table Columns
    By Mirl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-03-2014, 08:26 AM
  6. Replies: 0
    Last Post: 10-15-2012, 01:58 PM
  7. copy whole (selected) rows in another table with different labels
    By BorisMKD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2008, 01:49 PM

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