Transpose data ready for pivot table

mattchewie

New Member
Joined
Sep 17, 2018
Messages
4
Hi all,

I have data on 3 different tabs. 1 for stock on hand, 1 for sales, and i need to convert them to the the way i have it on the "Data for Pivot" tab. The data i have cannot be changed as this is the format i get it in. I basically want to combine SOH and sales by store, but then be able to have it in a line listing for a pivot table.
I have tried transposing it which works, but i need the line duplicated to show all models. The real data i have has around 200 stores, and 500 models, so i need a dump and process method... ideas?

an example below:

Stock on hand tab

Store AStore BStore CStore D
Model 11234
Model 21234
Model 31234
Model 41234

<tbody>
</tbody>

Sales Tab
Store AStore BStore CStore D
Model 11212
Model 21212
Model 31212
Model 41212

<tbody>
</tbody>

StoreModelSOHSales
Store AModel 111
Store AModel 211
Store AModel 311
Store AModel 411
Store BModel 122
Store BModel 222
Store BModel 322
Store BModel 422
Store CModel 131
Store CModel 231
Store CModel 331
Store CModel 431
Store DModel 142
Store DModel 242
Store DModel 342
Store DModel 442

<tbody>
</tbody>
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
try PowerQuery

ModelStore AStore BStore CStore DModelStore AStore BStore CStore DstoreModelsohsales
Model 1
1​
2​
3​
4​
Model 1
1​
2​
1​
2​
Store AModel 2
1​
1​
Model 2
1​
2​
3​
4​
Model 2
1​
2​
1​
2​
Store AModel 4
1​
1​
Model 3
1​
2​
3​
4​
Model 3
1​
2​
1​
2​
Store AModel 3
1​
1​
Model 4
1​
2​
3​
4​
Model 4
1​
2​
1​
2​
Store AModel 1
1​
1​
Store BModel 3
2​
2​
Store BModel 4
2​
2​
Store BModel 1
2​
2​
Store BModel 2
2​
2​
Store CModel 3
3​
1​
Store CModel 4
3​
1​
Store CModel 1
3​
1​
Store CModel 2
3​
1​
Store DModel 4
4​
2​
Store DModel 1
4​
2​
Store DModel 2
4​
2​
Store DModel 3
4​
2​

UnPivot each table then Merge them


Merge:
Code:
[SIZE=1]let
    Source = Table.NestedJoin(Table1,{"Model", "Attribute"},Table2,{"Model", "Attribute"},"Table2",JoinKind.LeftOuter),
    #"Expanded Table2" = Table.ExpandTableColumn(Source, "Table2", {"Value"}, {"Table2.Value"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Table2",{"Attribute", "Model", "Value", "Table2.Value"}),
    #"Renamed Columns" = Table.RenameColumns(#"Reordered Columns",{{"Value", "soh"}, {"Table2.Value", "sales"}, {"Attribute", "store"}}),
    #"Sorted Rows" = Table.Sort(#"Renamed Columns",{{"store", Order.Ascending}})
in
    #"Sorted Rows"[/SIZE]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,053
Members
449,206
Latest member
Healthydogs

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