+ Reply to Thread
Results 1 to 5 of 5

List row and column headers from 2-D array based on cell contents

  1. #1
    Registered User
    Join Date
    08-13-2014
    Location
    Northern Virginia
    MS-Off Ver
    2010 & 2013
    Posts
    2

    List row and column headers from 2-D array based on cell contents

    I have a spreadsheet that lists over 100 college courses in a row across the top and about 400 hundred learning objectives in a column down the left side. Each course has been examined to determine which learning objectives are addressed in the course. If a course addresses a learning objective, an X is placed in the cell where the course column and learning objective row intersect, as shown in the example below. Most of the approximately 40,000 cells are empty, but about 1,500 contain an X.

    Matrix.JPG

    I need to create a two-column list of all of the learning objective to course number matches on a separate spreadsheet. That is, for every X in the cells, I need the learning objective listed in column A and the matching course number listed in column B. This requires that information from the 2-D spreadsheet be consolidated into the two vertical columns as shown in this example:

    List.JPG

    I'm currently doing this manually, by filtering each column, one at a time, to show only the Xs and then copying and pasting the corresponding learning objective numbers into a second spreadsheet. Needless to say, this is very tedious, time consuming, and vulnerable to human error.

    I'd appreciate any advice.

  2. #2
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,375

    Re: List row and column headers from 2-D array based on cell contents

    Hi there

    You have your sample workbook? Try to upload it at the forum, to avoid that we re-type again your data. Click "Go Advanced" button and find paperclip button to attach the file.

    Thanks

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2407 Win 11 Home 64 Bit
    Posts
    24,067

    Re: List row and column headers from 2-D array based on cell contents

    Try this:

    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    08-13-2014
    Location
    Northern Virginia
    MS-Off Ver
    2010 & 2013
    Posts
    2

    Re: List row and column headers from 2-D array based on cell contents

    Alan,

    Thanks so much for the VBA code and directions on its use. Your code worked perfectly and saved me a huge amount of time over the manual method I was using to get this work done. I really do appreciate your clever solution.

    Baler5

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2407 Win 11 Home 64 Bit
    Posts
    24,067

    Re: List row and column headers from 2-D array based on cell contents

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Replies: 0
    Last Post: 09-11-2013, 09:54 AM
  2. Returning non-blank cell column/row headers to new array
    By jjkellog in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-19-2013, 10:45 AM
  3. Creating a filter to select sets of column based on merged cell headers
    By keepingitcole in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-25-2013, 11:43 AM
  4. Replies: 2
    Last Post: 05-09-2012, 01:30 PM
  5. Copy contents of Cell to array based on Col1 value not null
    By missleigh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-12-2006, 05:20 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