Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

Summarizing Excel Spreadsheet Data

Posted on 2013-12-05
Medium Priority
343 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
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

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
``````
0

Author Closing Comment

ID: 39702491
Works like a charm! Thank you!
0

Featured Post

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
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 using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Suggested Courses
Course of the Month6 days, 16 hours left to enroll

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

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