Transposing multiple tables

Nanaia

Active Member
Joined
Jan 11, 2018
Messages
306
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have a worksheet that has 5 tables on it and all of them are transposed with the weekly breakdown going by column instead of by row. I'm trying to find a way to (easily) transpose all 5 tables so I can pull the data from them into a combined table more efficiently. I'd like to avoid having to select every cell needed to create a chart for comparing weeks. Is there a command that will do this or do I need to go through every cell of every table to accomplish this?
Thanks.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
This appears to be something you can do with Power Query/Get and Transform.
 
Upvote 0
Looking online to see how to do Power Query/Get and Transforming I've tested this. It looks like it will work except for one snag... the files I'm receiving are set up with the weeks in the columns and the criteria being tallied in the rows. Excel keeps looking at the columns and totaling them and I need it to look at the rows. I have five tables contained on one worksheet. (I use the term "table" as a description, they aren't formatted as a table within Excel. It's simply data entered and ordered as if it were a table) Each table set up the same and am scratching my head on how to combine the data without having to manually reorder it. It would be easy if it was just one worksheet, but I have 34 worksheets set up similarly. Once I get one figured out, I will apply the same strategy to the rest. I am trying to get the data organized so I can create a chart based on the row headers instead of the column headers. This is the first time I've had to work with worksheets compiled by someone else so I guess I'm struggling a bit.

Here is an example for the first month:
2018 - AZ11/26/1812/03/1812/10/1812/17/1812/24/18Dec-18
External Weight 83,286.03 174,206.64 136,467.28 149,441.31 25,770.02 569,171.28
Internal Weight 12,860.56 28,575.24 6,449.36 39,892.54 950.26 88,727.96
Outside Jobs -
Transferred Weight -
Total Weight 96,146.59 202,781.88 142,916.64 189,333.85 26,720.28 657,899.24
Mfg. Weight 93,496.38 199,081.40 139,814.50 187,221.59 26,390.75 646,004.62
External Tons41.6487.1068.2374.7212.89284.59
Internal Tons6.4314.293.2219.950.4844.36
Outside Tonnage0.000.000.000.000.000.00
Transferred Tons0.000.000.000.000.000.00
Total Tons48.07101.3971.4694.6713.36328.95
Total Mfg Tons46.7599.5469.9193.6113.20323.00
Man Hours 1,765.50 1,499.10 1,743.07 1,591.50 696.92 7,296.09
Man Hours per Ton 36.73 14.79 24.39 16.81 52.1622.18
Mfg Man Hrs per Ton 37.77 15.06 24.93 17.00 52.8222.59

<colgroup><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
I have tranposed the data to look like below. If this is what you are looking for, then the Mcode follows.

Data Range
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
1
2018 - AZ​
External Weight​
Internal Weight​
Outside Jobs​
Transferred Weight​
Total Weight​
Mfg. Weight​
External Tons​
Internal Tons​
Outside Tonnage​
Transferred Tons​
Total Tons​
Total Mfg Tons​
Man Hours​
Man Hours per Ton​
Mfg Man Hrs per Ton​
2
11/26/2018​
83286.03​
12860.56​
96146.59​
93496.38​
41.64​
6.43​
0​
0​
48.07​
46.75​
1765.5​
36.73​
37.77​
3
12/3/2018​
174206.64​
28575.24​
202781.88​
199081.4​
87.1​
14.29​
0​
0​
101.39​
99.54​
1499.1​
14.79​
15.06​
4
12/10/2018​
136467.28​
6449.36​
142916.64​
139814.5​
68.23​
3.22​
0​
0​
71.46​
69.91​
1743.07​
24.39​
24.93​
5
12/17/2018​
149441.31​
39892.54​
189333.85​
187221.59​
74.72​
19.95​
0​
0​
94.67​
93.61​
1591.5​
16.81​
17​
6
12/24/2018​
25770.02​
950.26​
26720.28​
26390.75​
12.89​
0.48​
0​
0​
13.36​
13.2​
696.92​
52.16​
52.82​
7
12/18/2019​
569171.28​
88727.96​
-​
-​
657899.24​
646004.62​
284.59​
44.36​
0​
0​
328.95​
323​
7296.09​
22.18​
22.59​

<tbody>
</tbody>

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"2018 - AZ", type text}, {"11/26/2018", type number}, {"12/3/2018", type number}, {"12/10/2018", type number}, {"12/17/2018", type number}, {"12/24/2018", type number}, {"12/18/2019", type any}}),
    #"Demoted Headers" = Table.DemoteHeaders(#"Changed Type"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Demoted Headers",{{"Column1", type text}, {"Column2", type any}, {"Column3", type any}, {"Column4", type any}, {"Column5", type any}, {"Column6", type any}, {"Column7", type any}}),
    #"Transposed Table" = Table.Transpose(#"Changed Type1"),
    #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
    #"Changed Type2" = Table.TransformColumnTypes(#"Promoted Headers",{{"2018 - AZ", type date}, {"External Weight", type number}, {"Internal Weight", type number}, {"Outside Jobs", type text}, {"Transferred Weight", type text}, {"Total Weight", type number}, {"Mfg. Weight", type number}, {"External Tons", type number}, {"Internal Tons", type number}, {"Outside Tonnage", Int64.Type}, {"Transferred Tons", Int64.Type}, {"Total Tons", type number}, {"Total Mfg Tons", type number}, {"Man Hours", type number}, {"Man Hours per Ton", type number}, {"Mfg Man Hrs per Ton", type number}})
in
    #"Changed Type2"
 
Last edited:
Upvote 0
Power Query worked to transpose all of them. Thanks.
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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