#1   Report Post  
Gary G
 
Posts: n/a
Default Reorient Table

I have been given (for analysis) a table imported into Excel with two
vairables, but a strange orientation:

"date1,date2,date3, etc." is in the odd numbered rows, and
"n1,n2,n3,etc." is in the cells of the even numbered rows (below) and is the
number of times the event of interest occurred on the dates in the Odd-row
above. This repeats for several jundred rows. Each date-row represents a
week...so there are 7 columns of date-over-number,date-over-number, etc.

Is there a simple way (macro?) to reorient the data into a more manageable
two-row or two-column format?
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Gary,

Assuming all that you have in the worksheet is the table, select a single
cell in the table and run the macro below to reorient the table into a two
column table.

HTH,
Bernie
MS Excel MVP

Sub GaryReorientTable()
Dim myRange As Range
Dim i As Integer

Set myRange = ActiveCell.CurrentRegion
For i = 1 To myRange.Rows.Count Step 2
myRange.Rows(i).Resize(2).Copy
Cells(65536, myRange(1, 1).Column + 8) _
.End(xlUp)(2).PasteSpecial Transpose:=True
Next i
End Sub



"Gary G" <Gary wrote in message
...
I have been given (for analysis) a table imported into Excel with two
vairables, but a strange orientation:

"date1,date2,date3, etc." is in the odd numbered rows, and
"n1,n2,n3,etc." is in the cells of the even numbered rows (below) and is

the
number of times the event of interest occurred on the dates in the Odd-row
above. This repeats for several jundred rows. Each date-row represents a
week...so there are 7 columns of date-over-number,date-over-number, etc.

Is there a simple way (macro?) to reorient the data into a more manageable
two-row or two-column format?



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 services Craig Excel Discussion (Misc queries) 5 January 19th 05 06:11 PM
table dow Excel Discussion (Misc queries) 0 January 12th 05 02:25 PM
changing proportion of chart and data table Dawn Parks Charts and Charting in Excel 3 January 6th 05 01:18 AM
Running Data Table using an input that triggers DDE linked data [email protected] Excel Discussion (Misc queries) 1 December 16th 04 11:56 AM
Data Table - Does it work with DDE links and stock tickers? Post Tenebras Lux Excel Discussion (Misc queries) 0 December 1st 04 05:15 PM


All times are GMT +1. The time now is 07:37 PM.

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

About Us

"It's about Microsoft Excel"