Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rob Cherry
 
Posts: n/a
Default Extracting values from a table

I have a table which shows a tick in the cells where a combination of both
the column and row headings is valid. I want to extract from this table one
record for each valid combination of by concatenating the column heading and
row heading e.g.

Table looks like this:

A B C
1 x x
2 x
3 x x

Result required:

A1
B2
B3
C1
C3

Can anyone out there help as I am completely stuck as to how to go about this?

Many thanks in anticipation



  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Extracting values from a table

One way is to use a macro:

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet
Dim LastRow As Long
Dim LastCol As Long
Dim iCol As Long
Dim iRow As Long
Dim oRow As Long

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

With CurWks
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
oRow = 0
For iCol = 2 To LastCol
For iRow = 2 To LastRow
If IsEmpty(.Cells(iRow, iCol).Value) Then
'do nothing
Else
oRow = oRow + 1
NewWks.Cells(oRow, "A").Value _
= .Cells(1, iCol).Value & .Cells(iRow, 1).Value
End If
Next iRow
Next iCol
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Rob Cherry wrote:

I have a table which shows a tick in the cells where a combination of both
the column and row headings is valid. I want to extract from this table one
record for each valid combination of by concatenating the column heading and
row heading e.g.

Table looks like this:

A B C
1 x x
2 x
3 x x

Result required:

A1
B2
B3
C1
C3

Can anyone out there help as I am completely stuck as to how to go about this?

Many thanks in anticipation


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Rob Cherry
 
Posts: n/a
Default Extracting values from a table

Dave

Many thanks that worked a treat

--
Rob Cherry


"Dave Peterson" wrote:

One way is to use a macro:

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet
Dim LastRow As Long
Dim LastCol As Long
Dim iCol As Long
Dim iRow As Long
Dim oRow As Long

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

With CurWks
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
oRow = 0
For iCol = 2 To LastCol
For iRow = 2 To LastRow
If IsEmpty(.Cells(iRow, iCol).Value) Then
'do nothing
Else
oRow = oRow + 1
NewWks.Cells(oRow, "A").Value _
= .Cells(1, iCol).Value & .Cells(iRow, 1).Value
End If
Next iRow
Next iCol
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Rob Cherry wrote:

I have a table which shows a tick in the cells where a combination of both
the column and row headings is valid. I want to extract from this table one
record for each valid combination of by concatenating the column heading and
row heading e.g.

Table looks like this:

A B C
1 x x
2 x
3 x x

Result required:

A1
B2
B3
C1
C3

Can anyone out there help as I am completely stuck as to how to go about this?

Many thanks in anticipation


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot table page filter not accepting multiple values. Workaround? jco Excel Worksheet Functions 2 September 25th 05 09:35 PM
Why won't pasted values from a formula appear in a pivot table B_4j Excel Discussion (Misc queries) 1 June 24th 05 06:53 PM
pivot table with selection values not included in the base data confused Charts and Charting in Excel 0 June 21st 05 02:42 PM
Pivot Table - Extracting specific data JT Excel Worksheet Functions 2 June 4th 05 04:16 PM
Pivot Table - Extracting specific data JT Excel Worksheet Functions 1 June 3rd 05 06:05 PM


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"