PC Review


Reply
Thread Tools Rate Thread

Data-Transpose Problem

 
 
Sam
Guest
Posts: n/a
 
      3rd Apr 2008
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 With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      3rd Apr 2008

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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transpose data and retain links to original data Neil Microsoft Excel Worksheet Functions 2 23rd Oct 2009 12:46 PM
Re: Transpose data Months & Data to Rows Dave Peterson Microsoft Excel Misc 6 8th Jan 2007 04:28 PM
transpose data KK Microsoft Excel New Users 3 22nd Oct 2006 02:43 AM
Partial transpose data problem TomC Microsoft Excel Discussion 0 6th Jun 2005 06:22 PM
put row/column transpose in obvious place, like DATA -Transpose (. =?Utf-8?B?RWR3YXJkeGExMg==?= Microsoft Excel Worksheet Functions 2 29th Sep 2004 01:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:28 AM.