Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Summarizing Excel Spreadsheet Data

Posted on 2013-12-05
2
Medium Priority
?
351 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
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

972 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