Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default convert matrix to flat file format

I gather similarly structured data from about 30 different sources. These
data are in matrix format (15 rows by 23 columns).
To be able to analyze the data with pivot tables, I want to convert them to
a flat file format, with pr line the row label, column label, and value.

What is the easiest way to do this? ( individually referring to each cell
and it's row and column label is too error prone / tedious, as I need to be
able to change the matrix format for every new version, which is about twice
yearly, and as I have more than 1 matrix format, according to the type of
source)

--
Think, then move
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default convert matrix to flat file format

Felix,

Select a cell in your table, then run the macro below.

This assumes that you have headers in the top row of your data table....

HTH,
Bernie
MS Excel MVP

Sub MakeDataBaseTableFromCrossTab()
Dim SummaryTableRange As Range
Dim PivotTableSheet As Worksheet
Set SummaryTableRange = ActiveCell.CurrentRegion
If SummaryTableRange.Count = 1 Or SummaryTableRange.Rows.Count < 3 Then
MsgBox "Select a cell in the summary table.", vbCritical
Exit Sub
End If
ActiveWorkbook.PivotCaches.Add _
(SourceType:=xlConsolidation, _
SourceData:=Array(SummaryTableRange.Address(True, True, xlR1C1, True))) _
.CreatePivotTable TableDestination:="", _
TableName:="PivotTable1"
Set PivotTableSheet = ActiveSheet
With PivotTableSheet
.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
.PivotTables("PivotTable1").DataPivotField.PivotIt ems("Sum of Value").Position = 1
.PivotTables("PivotTable1").PivotFields("Row").Ori entation = xlHidden
.PivotTables("PivotTable1").PivotFields("Column"). Orientation = xlHidden
End With
Range("B4").ShowDetail = True
Application.DisplayAlerts = False
PivotTableSheet.Delete
Application.DisplayAlerts = True
End Sub



"Felix" wrote in message
...
I gather similarly structured data from about 30 different sources. These
data are in matrix format (15 rows by 23 columns).
To be able to analyze the data with pivot tables, I want to convert them to
a flat file format, with pr line the row label, column label, and value.

What is the easiest way to do this? ( individually referring to each cell
and it's row and column label is too error prone / tedious, as I need to be
able to change the matrix format for every new version, which is about twice
yearly, and as I have more than 1 matrix format, according to the type of
source)

--
Think, then move



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
Repeated data into flat file format Paul Simon Excel Worksheet Functions 4 July 9th 06 04:33 AM
How to convert a Pivot Table into a Flat File format? [email protected] Excel Discussion (Misc queries) 1 February 22nd 06 05:17 PM
how do I convert an excel file to a flat text file Lannutslp Excel Discussion (Misc queries) 1 June 3rd 05 10:17 AM
Convert excel file to flat text file Lannutslp Excel Discussion (Misc queries) 1 June 1st 05 03:48 AM
Convert excel file to flat text file Gary's Student Excel Discussion (Misc queries) 0 June 1st 05 12:17 AM


All times are GMT +1. The time now is 08:01 AM.

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"