Advanced Transpose help

cornwithbutter

New Member
Joined
Jun 15, 2023
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Dear Excel and data experts,

I would like to seek your help to create a formula/macro.
I currently have a product spreadsheet in a table format which I need to convert into a list for uploading onto the sales systems. The problem is I am not sure where/how to start off and was wondering if there is a term for such transpose method whereby both row/column data fields are transposed. Also for Row 4 and Column G are related so that I can combine to return the full product code. Currently I converting it with concatenate formula but this involves manually work. The catalogue contains almost 2000 price entries.

It would be grateful if you could point me in the right direction or similar cases I could reference from. Thank you very much!
 

Attachments

  • Reddit.png
    Reddit.png
    60.9 KB · Views: 25

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
With Power Query and amending source data ( split it into 2 tables) a small tweak, think this works
Book1
ABCDEFGHIJKLMNOPQRSTUV
1Column1Column2Column3Column4Column5Column6ORGDESAreaOrg CodeExtQuery1.Column2Query1.Column3Query1.Column4ProductCodeValue
2P CODEL-XXXXZ-xxxxP-xxxxxB-xxxxxAustraliaKoreaOceaniaAU8138x3c2BFxxxxx1500
3Prod Info 138383838AustraliaKoreaOceaniaAU8138x3c2BFxxxxx1000
4Prod Info 2x2x2x3x3AustraliaKoreaOceaniaAU8138x3c2BSxxxxx1000
5Prod Info 3c1c1c2c2USAKoreaUSUS6138x3c2BSxxxxx500
6ORGDESAreaOrg CodeExtSeasNmeSEASONL-XXXXZ-xxxxP-xxxxxB-xxxxxAustraliaKoreaOceaniaAU8138x3c2BWxxxxx2000
7JapanKoreaAsiaJP81WinterW2007001500JapanKoreaAsiaJP8138x3c2BWxxxxx1500
8AustraliaKoreaOceaniaAU81FallF2504501000AustraliaKoreaOceaniaAU8138x2c1LFXXXX450
9USAKoreaUSUS61SummerS150160500USAKoreaUSUS6138x2c1LSXXXX150
10AustraliaKoreaOceaniaAU81WinterW6508002000AustraliaKoreaOceaniaAU8138x2c1LSXXXX280
11AustraliaKoreaOceaniaAU81FallF4503501500JapanKoreaAsiaJP8138x2c1LWXXXX200
12AustraliaKoreaOceaniaAU81SummerS2802006001000AustraliaKoreaOceaniaAU8138x2c1LWXXXX650
13AustraliaKoreaOceaniaAU8138x3c2PFxxxxx450
14AustraliaKoreaOceaniaAU8138x3c2PSxxxxx600
15JapanKoreaAsiaJP8138x3c2PWxxxxx700
16AustraliaKoreaOceaniaAU8138x3c2PWxxxxx800
17AustraliaKoreaOceaniaAU8138x2c1ZFxxxx250
18AustraliaKoreaOceaniaAU8138x2c1ZFxxxx350
19AustraliaKoreaOceaniaAU8138x2c1ZSxxxx200
20USAKoreaUSUS6138x2c1ZSxxxx160
Sheet1
 
Upvote 0
Table 4 which is Product info is imported to PQ and transposed to allow mapping to table 5
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table4"]}[Content],
    #"Removed Columns" = Table.RemoveColumns(Source,{"Column2"}),
    #"Transposed Table" = Table.Transpose(#"Removed Columns")
in
    #"Transposed Table"
1686827593794.png


Table 5 which has prices etc is brought in , here are applied steps
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table5"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ORG", type text}, {"DES", type text}, {"Area", type text}, {"Org Code", type text}, {"Ext", Int64.Type}, {"SeasNme", type text}, {"SEASON", type text}, {"L-XXXX", Int64.Type}, {"Z-xxxx", Int64.Type}, {"P-xxxxx", Int64.Type}, {"B-xxxxx", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"ORG", "DES", "Area", "Org Code", "Ext", "SeasNme", "SEASON"}, "Attribute", "Value"),
    #"Added Custom" = Table.AddColumn(#"Unpivoted Columns", "ProductCode", each Text.BeforeDelimiter([Attribute],"-") &[SEASON]&Text.AfterDelimiter([Attribute],"-")),
    #"Reordered Columns" = Table.ReorderColumns(#"Added Custom",{"ORG", "DES", "Area", "Org Code", "Ext", "SeasNme", "SEASON", "Attribute", "ProductCode", "Value"}),
    #"Merged Queries" = Table.NestedJoin(#"Reordered Columns", {"Attribute"}, #"Table 4", {"Column1"}, "Query1", JoinKind.LeftOuter),
    #"Expanded Query1" = Table.ExpandTableColumn(#"Merged Queries", "Query1", {"Column1", "Column2", "Column3", "Column4"}, {"Query1.Column1", "Query1.Column2", "Query1.Column3", "Query1.Column4"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Query1",{"Query1.Column1"}),
    #"Reordered Columns1" = Table.ReorderColumns(#"Removed Columns",{"ORG", "DES", "Area", "Org Code", "Ext", "Query1.Column2", "Query1.Column3", "Query1.Column4", "SeasNme", "SEASON", "Attribute", "ProductCode", "Value"}),
    #"Removed Columns1" = Table.RemoveColumns(#"Reordered Columns1",{"SeasNme", "SEASON", "Attribute"}),
    #"Sorted Rows" = Table.Sort(#"Removed Columns1",{{"ProductCode", Order.Ascending}})
in
    #"Sorted Rows"

1686827713188.png
 
Upvote 0
Solution
Thank you so much I followed the steps and managed to generate the list as intended! You are a life saver :)
 
Upvote 0
Table 4 which is Product info is imported to PQ and transposed to allow mapping to table 5
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table4"]}[Content],
    #"Removed Columns" = Table.RemoveColumns(Source,{"Column2"}),
    #"Transposed Table" = Table.Transpose(#"Removed Columns")
in
    #"Transposed Table"
View attachment 93637

Table 5 which has prices etc is brought in , here are applied steps
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table5"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ORG", type text}, {"DES", type text}, {"Area", type text}, {"Org Code", type text}, {"Ext", Int64.Type}, {"SeasNme", type text}, {"SEASON", type text}, {"L-XXXX", Int64.Type}, {"Z-xxxx", Int64.Type}, {"P-xxxxx", Int64.Type}, {"B-xxxxx", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"ORG", "DES", "Area", "Org Code", "Ext", "SeasNme", "SEASON"}, "Attribute", "Value"),
    #"Added Custom" = Table.AddColumn(#"Unpivoted Columns", "ProductCode", each Text.BeforeDelimiter([Attribute],"-") &[SEASON]&Text.AfterDelimiter([Attribute],"-")),
    #"Reordered Columns" = Table.ReorderColumns(#"Added Custom",{"ORG", "DES", "Area", "Org Code", "Ext", "SeasNme", "SEASON", "Attribute", "ProductCode", "Value"}),
    #"Merged Queries" = Table.NestedJoin(#"Reordered Columns", {"Attribute"}, #"Table 4", {"Column1"}, "Query1", JoinKind.LeftOuter),
    #"Expanded Query1" = Table.ExpandTableColumn(#"Merged Queries", "Query1", {"Column1", "Column2", "Column3", "Column4"}, {"Query1.Column1", "Query1.Column2", "Query1.Column3", "Query1.Column4"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Query1",{"Query1.Column1"}),
    #"Reordered Columns1" = Table.ReorderColumns(#"Removed Columns",{"ORG", "DES", "Area", "Org Code", "Ext", "Query1.Column2", "Query1.Column3", "Query1.Column4", "SeasNme", "SEASON", "Attribute", "ProductCode", "Value"}),
    #"Removed Columns1" = Table.RemoveColumns(#"Reordered Columns1",{"SeasNme", "SEASON", "Attribute"}),
    #"Sorted Rows" = Table.Sort(#"Removed Columns1",{{"ProductCode", Order.Ascending}})
in
    #"Sorted Rows"

View attachment 93638
Thank you so much I followed the steps and managed to generate the list as intended! You are a life saver :)
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,107
Members
453,021
Latest member
Justyna P

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