Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 3
Default Data-Transpose Problem

Hi All:
I have 4 excel sheets, from which I need to create 1 Access Table.
Now, The data is in the following format:

Quantity
Date A B
1/1/2008 97 42
1/2/2008 16 9
1/3/2008 59 25
1/4/2008 41 55
1/5/2008 77 8
1/6/2008 70 32
1/7/2008 80 71
1/8/2008 22 27
1/9/2008 36 45
1/10/2008 52 4

Now, I need to transpose this data in such a manner that I can use a
field for both A and B as the Primary Key. In other words, I need the
transposed data in this format:

P_Key Date Quantity
A 1/1/2008 97
A 1/2/2008 16
A 1/3/2008 59
A 1/4/2008 41
A 1/5/2008 77
A 1/6/2008 70
A 1/7/2008 80
A 1/8/2008 22
A 1/9/2008 36
A 1/10/2008 52
B 1/1/2008 42
B 1/2/2008 9
B 1/3/2008 25
B 1/4/2008 55
B 1/5/2008 8
B 1/6/2008 32
B 1/7/2008 71
B 1/8/2008 27
B 1/9/2008 45
B 1/10/2008 4

In this way, I can use the access table to link up with other tables,
to link-up the other data correspoding to "A" and "B".
I know this can be easily done in Excel with a simple transpose, but
this case is different. Like A and B, I have 640 individual items, the
quantities go beyong 1500 rows. And, both Excel and Access cannot
handle more than 255 columns of data, that being the limit.
So, if anybody could help me with this data-transpose problem, I will
really appreciate it !!! I need to fine-tune this database for a
client's data before the end of tomorrow.

Thanks,
Regards,
S.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Data-Transpose Problem


Sub transpose()

Sh1RowCount = 1
Sh2RowCount = 1

With Sheets("Sheet1")
Do While .Range("A" & Sh1RowCount) < ""
MyDate = .Range("A" & Sh1RowCount)
A_Quant = .Range("B" & Sh1RowCount)
B_Quant = .Range("C" & Sh1RowCount)
With Sheets("Sheet2")
.Range("A" & Sh2RowCount) = "A"
.Range("B" & Sh2RowCount) = MyDate
.Range("C" & Sh2RowCount) = A_Quant
.Range("A" & (Sh2RowCount + 1)) = "B"
.Range("B" & (Sh2RowCount + 1)) = MyDate
.Range("C" & (Sh2RowCount + 1)) = B_Quant
Sh2RowCount = Sh2RowCount + 2
End With
Sh1RowCount = Sh1RowCount + 1
Loop
End With
With Sheets("Sheet2")
Lastrow = Sh2RowCount - 1
Set SortRange = .Range("A1:C" & Lastrow)
SortRange.Sort _
Key1:=Range("A1"), _
Order1:=xlAscending, _
Key2:=Range("B1"), _
Order2:=xlAscending, _
Header:=xlGuess
End With
End Sub
"Sam" wrote:

Hi All:
I have 4 excel sheets, from which I need to create 1 Access Table.
Now, The data is in the following format:

Quantity
Date A B
1/1/2008 97 42
1/2/2008 16 9
1/3/2008 59 25
1/4/2008 41 55
1/5/2008 77 8
1/6/2008 70 32
1/7/2008 80 71
1/8/2008 22 27
1/9/2008 36 45
1/10/2008 52 4

Now, I need to transpose this data in such a manner that I can use a
field for both A and B as the Primary Key. In other words, I need the
transposed data in this format:

P_Key Date Quantity
A 1/1/2008 97
A 1/2/2008 16
A 1/3/2008 59
A 1/4/2008 41
A 1/5/2008 77
A 1/6/2008 70
A 1/7/2008 80
A 1/8/2008 22
A 1/9/2008 36
A 1/10/2008 52
B 1/1/2008 42
B 1/2/2008 9
B 1/3/2008 25
B 1/4/2008 55
B 1/5/2008 8
B 1/6/2008 32
B 1/7/2008 71
B 1/8/2008 27
B 1/9/2008 45
B 1/10/2008 4

In this way, I can use the access table to link up with other tables,
to link-up the other data correspoding to "A" and "B".
I know this can be easily done in Excel with a simple transpose, but
this case is different. Like A and B, I have 640 individual items, the
quantities go beyong 1500 rows. And, both Excel and Access cannot
handle more than 255 columns of data, that being the limit.
So, if anybody could help me with this data-transpose problem, I will
really appreciate it !!! I need to fine-tune this database for a
client's data before the end of tomorrow.

Thanks,
Regards,
S.



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
Problem in Transpose Hetal Vora Excel Discussion (Misc queries) 1 February 9th 09 06:55 PM
Transpose problem Barry Lennox[_2_] Excel Discussion (Misc queries) 4 January 7th 09 07:04 PM
Transpose Problem Hazel Excel Discussion (Misc queries) 3 February 20th 07 05:55 PM
Transpose problem lt[_2_] Excel Programming 2 October 20th 06 09:01 PM
Transpose Problem Biman Excel Discussion (Misc queries) 5 January 13th 05 01:31 PM


All times are GMT +1. The time now is 08:46 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"