Solved

Summarizing Excel Spreadsheet Data

Posted on 2013-12-05
2
290 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 500 total points
Comment Utility
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
Comment Utility
Works like a charm! Thank you!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
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;…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now