Transposition lookup

Salamullah

Board Regular
Joined
Mar 28, 2011
Messages
221
Please help me to bring data from Horizontal array to vertical area.


[TABLE="width: 384"]
<colgroup><col width="64" style="width: 48pt;" span="8"> <tbody>[TR]
[TD="width: 128, bgcolor: transparent, colspan: 2, align: left"]Horizontal[/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: left"]Volume[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: left"]Profit[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]Product[/TD]
[TD="bgcolor: transparent, align: left"]Jan[/TD]
[TD="bgcolor: transparent, align: left"]Feb[/TD]
[TD="bgcolor: transparent, align: left"]Mar[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: left"]Jan[/TD]
[TD="bgcolor: transparent, align: left"]Feb[/TD]
[TD="bgcolor: transparent, align: left"]Mar[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]A[/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[TD="bgcolor: transparent, align: right"]40[/TD]
[TD="bgcolor: transparent, align: right"]70[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]120[/TD]
[TD="bgcolor: transparent, align: right"]520[/TD]
[TD="bgcolor: transparent, align: right"]1680[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]B[/TD]
[TD="bgcolor: transparent, align: right"]20[/TD]
[TD="bgcolor: transparent, align: right"]50[/TD]
[TD="bgcolor: transparent, align: right"]80[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]180[/TD]
[TD="bgcolor: transparent, align: right"]250[/TD]
[TD="bgcolor: transparent, align: right"]720[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]C[/TD]
[TD="bgcolor: transparent, align: right"]30[/TD]
[TD="bgcolor: transparent, align: right"]60[/TD]
[TD="bgcolor: transparent, align: right"]90[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]150[/TD]
[TD="bgcolor: transparent, align: right"]180[/TD]
[TD="bgcolor: transparent, align: right"]600[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]Vertical[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]Product[/TD]
[TD="bgcolor: transparent, align: left"]Month[/TD]
[TD="bgcolor: transparent, align: left"]Volume[/TD]
[TD="bgcolor: transparent, align: left"]Profit[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]A[/TD]
[TD="bgcolor: transparent, align: left"]Jan[/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[TD="bgcolor: transparent, align: right"]120[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]B[/TD]
[TD="bgcolor: transparent, align: left"]Jan[/TD]
[TD="bgcolor: transparent, align: right"]20[/TD]
[TD="bgcolor: transparent, align: right"]180[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]C[/TD]
[TD="bgcolor: transparent, align: left"]Jan[/TD]
[TD="bgcolor: transparent, align: right"]30[/TD]
[TD="bgcolor: transparent, align: right"]150[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]A[/TD]
[TD="bgcolor: transparent, align: left"]Feb[/TD]
[TD="bgcolor: transparent, align: right"]40[/TD]
[TD="bgcolor: transparent, align: right"]520[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]B[/TD]
[TD="bgcolor: transparent, align: left"]Feb[/TD]
[TD="bgcolor: transparent, align: right"]50[/TD]
[TD="bgcolor: transparent, align: right"]250[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]C[/TD]
[TD="bgcolor: transparent, align: left"]Feb[/TD]
[TD="bgcolor: transparent, align: right"]60[/TD]
[TD="bgcolor: transparent, align: right"]180[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]A[/TD]
[TD="bgcolor: transparent, align: left"]Mar[/TD]
[TD="bgcolor: transparent, align: right"]70[/TD]
[TD="bgcolor: transparent, align: right"]1680[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]B[/TD]
[TD="bgcolor: transparent, align: left"]Mar[/TD]
[TD="bgcolor: transparent, align: right"]80[/TD]
[TD="bgcolor: transparent, align: right"]720[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]C[/TD]
[TD="bgcolor: transparent, align: left"]Mar[/TD]
[TD="bgcolor: transparent, align: right"]90[/TD]
[TD="bgcolor: transparent, align: right"]600[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
VBA solution

Code:
Sub k1()
Lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
k = 2
For i = 2 To 4
For j = 4 To Lastrow
k = k + 1
Worksheets("Sheet2").Cells(k, 1) = Worksheets("Sheet1").Cells(j, 1)
Worksheets("Sheet2").Cells(k, 2) = Worksheets("Sheet1").Cells(3, i)
Worksheets("Sheet2").Cells(k, 3) = Worksheets("Sheet1").Cells(j, i)
Worksheets("Sheet2").Cells(k, 4) = Worksheets("Sheet1").Cells(j, i + 4)
Next j
Next i

End Sub

Input on Sheet1 with Horizontal in A1
Output on Sheet2
 
Upvote 0
Hi Special,

Many thanks and sorry for the late reply I have multi tabs so if excel formula is availble than it will be great !
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top