Help : Copying excel Rows to columns.

Creekleo

New Member
Joined
Dec 15, 2021
Messages
30
Office Version
  1. 2013
Platform
  1. Windows
Hello community,
I have a problem and would like to find a solution if possible.
I tried to explain all in the excel file attached. thank you

Canevas.xlsb
ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1Main table
2JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
3CodeAGENCYPRODUCTSNVNVNVNVNVNVNVNVNVNVNVNV
45244AGENCY 11203480,784223484,761269599,479221532,471224529,479226570,051228628,523220649,023245649,109253600,831262612,235284663,254
55244AGENCY 12798710586878889869598102111
65244AGENCY 1339103,02543103,87752128,46043114,10144113,46044122,15444134,68343139,07648139,09549128,74951131,19355142,126
75244AGENCY 14000000000000000000000000
85244AGENCY 152468,6832769,2523385,6402776,0672775,6402781,4362789,7892792,7183092,7303085,8333287,4623494,751
95244AGENCY 16000000000000000000000000
105244AGENCY 172254,9472455,4012968,5122460,8542460,5122465,1492571,8312474,1742674,1842768,6662869,9703175,801
115244AGENCY 18000000000000000000000000
125244AGENCY 19000000000000000000000000
135244AGENCY 110000000000000000000000000
145244AGENCY 111000000000000000000000000
155244AGENCY 112000000000000000000000000
165244AGENCY 113212328232424242326272830
175244AGENCY 114781088888991010
185244AGENCY 115131417141414141415161718
195244AGENCY 116000000000000
205244AGENCY 117000000000000
21
22I want to copy the months highlighted in orange color above from columns to rows then copy products data then agency code then agency name and then N and V data to the table below and I need to do this for every month from january to december. The goal is to convert the table above into the format in the table here. I have so maany data and i can't be copying elements by elements if there is any fast solution to this. thanks so much.
23
24
25
26Results wanted
27MonthProductsCode agencyAgencyNV
28January15244AGENCY 1203480,784
29January25244AGENCY 179
30January35244AGENCY 139103,025
31January45244AGENCY 100
32January55244AGENCY 12468,683
33January65244AGENCY 100
34January75244AGENCY 12254,947
35January85244AGENCY 100
36January95244AGENCY 100
37January105244AGENCY 100
38January115244AGENCY 100
39January125244AGENCY 100
40January135244AGENCY 121
41January145244AGENCY 17
42January155244AGENCY 113
43January165244AGENCY 10
44January175244AGENCY 10
45February15244AGENCY 1223484,761
46February25244AGENCY 187
47February35244AGENCY 143103,877
48February45244AGENCY 100
49February55244AGENCY 12769,252
50February65244AGENCY 100
51February75244AGENCY 12455,401
52February85244AGENCY 100
53February95244AGENCY 100
54February105244AGENCY 100
55February115244AGENCY 100
56February125244AGENCY 100
57February135244AGENCY 123
58February145244AGENCY 18
59February155244AGENCY 114
60February165244AGENCY 10
61February175244AGENCY 10
62AND SO ON Until december DATA is done I will need to copy elements by elements.
63
64
65
66
67
68
69
70
71
72
Canevas OBJ nouvelle ouverture
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E45:F45Cell Value<0textNO
E47:F56Cell Value<0textNO
D46:D61Expression=MOD(ROW(),2)textNO
D46:D61Expression=MOD(ROW(),2)=0textNO
D46:D61Expression=MOD(ROW(),2)=0textNO
D45Expression=MOD(ROW(),2)textNO
D45Expression=MOD(ROW(),2)=0textNO
D45Expression=MOD(ROW(),2)=0textNO
E29:F44Cell Value<0textNO
E28:F28Cell Value<0textNO
D29:D44Expression=MOD(ROW(),2)textNO
D29:D44Expression=MOD(ROW(),2)=0textNO
D29:D44Expression=MOD(ROW(),2)=0textNO
D28Expression=MOD(ROW(),2)textNO
D28Expression=MOD(ROW(),2)=0textNO
D28Expression=MOD(ROW(),2)=0textNO
B5:B20Expression=MOD(ROW(),2)textNO
B5:B20Expression=MOD(ROW(),2)=0textNO
B5:B20Expression=MOD(ROW(),2)=0textNO
B4Expression=MOD(ROW(),2)textNO
B4Expression=MOD(ROW(),2)=0textNO
B4Expression=MOD(ROW(),2)=0textNO
D4:AA4Cell Value<0textNO
D6:AA15Cell Value<0textNO
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
The rearrangements of the data can be achieved via either VBA or Power Query. Which do you want to use ?

The output will not have your conditional formatting on it though. The banding can be done simply by using a table which the PQ output will do automatically.

PS: you have merged cells in Row 2 most seasoned excel user consider this a really bad idea and would use horizontal > center across selection to achieve an identical look. PQ will break unmerge those cells.
 
Upvote 0
If you want to use Power Query, Leila Gharani's video here will walk you through the steps.
(13.5 mins)
I think the only change I made to the what is in the video was that since you have merged cells in the heading, after converting the data to a table I selected applied Alignment > Horizontal > Center across selection to each month in the headings row (which is now 1 row lower and on row 3)

 
Upvote 0
Thank you so much Mr.Alex for the help ! I will try to apply all your remarks and get back to you if it worked. Thanks
 
Upvote 0

Forum statistics

Threads
1,215,639
Messages
6,125,967
Members
449,276
Latest member
surendra75

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