Solved

Summarizing Excel Spreadsheet Data

Posted on 2013-12-05
2
335 Views
Last Modified: 2013-12-06
I have a large excel spreadsheet that has row headings in column 1, and column headings in row 1. At the intersection of certain columns an rows the table has "X" or "x" signs.

The sample table is below
     1e  2f  3g  4h  5k  6l  7m  8n
1a                   X
1b       X
1c        X                X
1d                         X

I need a macro that generates a summary of the table above by generating another spreadsheet by listing the column heading first and then each row heading that has a corresponding X next to it. Based on the example above, the resulting spreadsheet should look like this:

2f, 1b, 1c
4h, 1a
5k, 1c, 1d

Thank you, Experts!
0
Comment
Question by:cyber-33
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39700152
Sub tbl2lst()
Dim col As Range
Dim rw As Range
Dim rstr As String
For Each col In Sheet1.Range(Sheet1.Range("B1"), Sheet1.Range("B1").End(xlToRight))
    rstr = col.Value
    For Each rw In Sheet1.Range(Sheet1.Range("A2"), Sheet1.Range("A2").End(xlDown))
    If UCase(Intersect(col.EntireColumn, rw.EntireRow)) = "X" Then
        rstr = rstr & ", " & rw.Value
    End If
    Next rw
    If rstr <> col.Value Then Sheet2.Range("A" & Rows.Count).End(xlUp).Offset(1) = rstr
Next col
End Sub

Open in new window

0
 

Author Closing Comment

by:cyber-33
ID: 39702491
Works like a charm! Thank you!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question