Transposition lookup

Salamullah

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


Horizontal
VolumeProfit
ProductJanFebMarJanFebMar
A1040701205201680
B205080180250720
C306090150180600
Vertical
ProductMonthVolumeProfit
AJan10120
BJan20180
CJan30150
AFeb40520
BFeb50250
CFeb60180
AMar701680
BMar80720
CMar90600
<colgroup><col width="64" style="width: 48pt;" span="8"> <tbody> </tbody>
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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