Convert the rows to Columns

aliikhlaq2006

New Member
Joined
Apr 4, 2012
Messages
44
Posting DateDocumentG/L Acct/BP NameInventory UoMQty
FG00017500 Litre Water Tank White
02.08.18SI 2109Finished GoodsPcs14
02.08.18SI 2109Finished GoodsPcs13
02.08.18SI 2111Finished GoodsPcs11
02.08.18SI 2111Finished GoodsPcs12
FG00018750 Litre Water Tank White
02.08.18SI 2109Finished GoodsPcs14
02.08.18SI 2109Finished GoodsPcs15
02.08.18SI 2111Finished GoodsPcs16
02.08.18SI 2111Finished GoodsPcs12
FG000191000 Litre Water Tank White
02.08.18SI 2109Finished GoodsPcs6
02.08.18SI 2109Finished GoodsPcs8
02.08.18SI 2111Finished GoodsPcs10
02.08.18SI 2111Finished GoodsPcs6


<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>
I want the above result to be displayed by this
Posting DateItem NameDocumentG/L Acct/BP NameInventory UoMQty
02.08.18500 Litre Water Tank WhiteSI 2109Finished GoodsPcs14
02.08.18500 Litre Water Tank WhiteSI 2109Finished GoodsPcs13
02.08.18500 Litre Water Tank WhiteSI 2111Finished GoodsPcs11
02.08.18500 Litre Water Tank WhiteSI 2111Finished GoodsPcs12
02.08.18750 Litre Water Tank WhiteSI 2109Finished GoodsPcs14
02.08.18750 Litre Water Tank WhiteSI 2109Finished GoodsPcs15
02.08.18750 Litre Water Tank WhiteSI 2111Finished GoodsPcs16
02.08.18750 Litre Water Tank WhiteSI 2111Finished GoodsPcs12
02.08.181000 Litre Water Tank WhiteSI 2109Finished GoodsPcs6
02.08.181000 Litre Water Tank WhiteSI 2109Finished GoodsPcs8
02.08.181000 Litre Water Tank WhiteSI 2111Finished GoodsPcs10
02.08.181000 Litre Water Tank WhiteSI 2111Finished GoodsPcs6

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Posting DateDocumentG/L Acct/BP NameInventory UoMQty
FG00017500 Litre Water Tank White
02.08.18SI 2109Finished GoodsPcs14
02.08.18SI 2109Finished GoodsPcs13
02.08.18SI 2111Finished GoodsPcs11
02.08.18SI 2111Finished GoodsPcs12
FG00018750 Litre Water Tank White
02.08.18SI 2109Finished GoodsPcs14
02.08.18SI 2109Finished GoodsPcs15
02.08.18SI 2111Finished GoodsPcs16
02.08.18SI 2111Finished GoodsPcs12
FG000191000 Litre Water Tank White
02.08.18SI 2109Finished GoodsPcs6
02.08.18SI 2109Finished GoodsPcs8
02.08.18SI 2111Finished GoodsPcs10
02.08.18SI 2111Finished GoodsPcs6
FG00017500 Litre Water Tank White
very easy to lay out like thisFG00018750 Litre Water Tank White
item name comes from a lookup of codeFG000191000 Litre Water Tank White
CODEPosting DateItem NameDocumentG/L Acct/BP NameInventory UoMQty
FG0001702.08.18500 Litre Water Tank WhiteSI 2109Finished GoodsPcs14
FG0001702.08.18500 Litre Water Tank WhiteSI 2109Finished GoodsPcs13
FG0001702.08.18500 Litre Water Tank WhiteSI 2111Finished GoodsPcs11
FG0001702.08.18500 Litre Water Tank WhiteSI 2111Finished GoodsPcs12
FG0001802.08.18750 Litre Water Tank WhiteSI 2109Finished GoodsPcs14
FG0001802.08.18750 Litre Water Tank WhiteSI 2109Finished GoodsPcs15
FG0001802.08.18750 Litre Water Tank WhiteSI 2111Finished GoodsPcs16
FG0001802.08.18750 Litre Water Tank WhiteSI 2111Finished GoodsPcs12
FG0001902.08.181000 Litre Water Tank WhiteSI 2109Finished GoodsPcs6
FG0001902.08.181000 Litre Water Tank WhiteSI 2109Finished GoodsPcs8
FG0001902.08.181000 Litre Water Tank WhiteSI 2111Finished GoodsPcs10
FG0001902.08.181000 Litre Water Tank WhiteSI 2111Finished GoodsPcs6

<colgroup><col><col><col><col><col><col><col span="2"><col></colgroup><tbody>
</tbody>
 
Upvote 0
Posting DateDocumentG/L Acct/BP NameInventory UoMQty
FG00017500 Litre Water Tank White
02.08.18SI 2109Finished GoodsPcs14
02.08.18SI 2109Finished GoodsPcs13
02.08.18SI 2111Finished GoodsPcs11
02.08.18SI 2111Finished GoodsPcs12
FG00018750 Litre Water Tank White
02.08.18SI 2109Finished GoodsPcs14
02.08.18SI 2109Finished GoodsPcs15
02.08.18SI 2111Finished GoodsPcs16
02.08.18SI 2111Finished GoodsPcs12
FG000191000 Litre Water Tank White
02.08.18SI 2109Finished GoodsPcs6
02.08.18SI 2109Finished GoodsPcs8
02.08.18SI 2111Finished GoodsPcs10
02.08.18SI 2111Finished GoodsPcs6
FG00017500 Litre Water Tank White
very easy to lay out like thisFG00018750 Litre Water Tank White
item name comes from a lookup of codeFG000191000 Litre Water Tank White
CODEPosting DateItem NameDocumentG/L Acct/BP NameInventory UoMQty
FG0001702.08.18500 Litre Water Tank WhiteSI 2109Finished GoodsPcs14
FG0001702.08.18500 Litre Water Tank WhiteSI 2109Finished GoodsPcs13
FG0001702.08.18500 Litre Water Tank WhiteSI 2111Finished GoodsPcs11
FG0001702.08.18500 Litre Water Tank WhiteSI 2111Finished GoodsPcs12
FG0001802.08.18750 Litre Water Tank WhiteSI 2109Finished GoodsPcs14
FG0001802.08.18750 Litre Water Tank WhiteSI 2109Finished GoodsPcs15
FG0001802.08.18750 Litre Water Tank WhiteSI 2111Finished GoodsPcs16
FG0001802.08.18750 Litre Water Tank WhiteSI 2111Finished GoodsPcs12
FG0001902.08.181000 Litre Water Tank WhiteSI 2109Finished GoodsPcs6
FG0001902.08.181000 Litre Water Tank WhiteSI 2109Finished GoodsPcs8
FG0001902.08.181000 Litre Water Tank WhiteSI 2111Finished GoodsPcs10
FG0001902.08.181000 Litre Water Tank WhiteSI 2111Finished GoodsPcs6

<tbody>
</tbody>
How can you tell me.
 
Upvote 0
If you are allowed to use PowerQuery (PC Excel: 2010/2013 add-in, 2016 and higher - built-in) you can try this

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Posting Date", type text}, {"Document", type text}, {"G/L Acct/BP Name", type text}, {"Inventory UoM", type text}, {"Qty", Int64.Type}}),
    #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Code", each if Text.Contains([Posting Date], "FG") then [Posting Date] else null),
    #"Added Conditional Column1" = Table.AddColumn(#"Added Conditional Column", "Item", each if Text.Contains([#"G/L Acct/BP Name"], "Water") then [#"G/L Acct/BP Name"] else null),
    #"Filtered Rows" = Table.SelectRows(#"Added Conditional Column1", each ([Posting Date] <> null)),
    #"Filled Down" = Table.FillDown(#"Filtered Rows",{"Code", "Item"}),
    #"Filtered Rows1" = Table.SelectRows(#"Filled Down", each ([Qty] <> null)),
    #"Reordered Columns" = Table.ReorderColumns(#"Filtered Rows1",{"Posting Date", "Code", "Item", "Document", "G/L Acct/BP Name", "Inventory UoM", "Qty"})
in
    #"Reordered Columns"


Posting DateCodeItemDocumentG/L Acct/BP NameInventory UoMQty
02.08.18FG00017500 Litre Water Tank WhiteSI 2109Finished GoodsPcs
14​
02.08.18FG00017500 Litre Water Tank WhiteSI 2109Finished GoodsPcs
13​
02.08.18FG00017500 Litre Water Tank WhiteSI 2111Finished GoodsPcs
11​
02.08.18FG00017500 Litre Water Tank WhiteSI 2111Finished GoodsPcs
12​
02.08.18FG00018750 Litre Water Tank WhiteSI 2109Finished GoodsPcs
14​
02.08.18FG00018750 Litre Water Tank WhiteSI 2109Finished GoodsPcs
15​
02.08.18FG00018750 Litre Water Tank WhiteSI 2111Finished GoodsPcs
16​
02.08.18FG00018750 Litre Water Tank WhiteSI 2111Finished GoodsPcs
12​
02.08.18FG000191000 Litre Water Tank WhiteSI 2109Finished GoodsPcs
6​
02.08.18FG000191000 Litre Water Tank WhiteSI 2109Finished GoodsPcs
8​
02.08.18FG000191000 Litre Water Tank WhiteSI 2111Finished GoodsPcs
10​
02.08.18FG000191000 Litre Water Tank WhiteSI 2111Finished GoodsPcs
6​
 
Upvote 0
If you are allowed to use PowerQuery (PC Excel: 2010/2013 add-in, 2016 and higher - built-in) you can try this

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Posting Date", type text}, {"Document", type text}, {"G/L Acct/BP Name", type text}, {"Inventory UoM", type text}, {"Qty", Int64.Type}}),
    #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Code", each if Text.Contains([Posting Date], "FG") then [Posting Date] else null),
    #"Added Conditional Column1" = Table.AddColumn(#"Added Conditional Column", "Item", each if Text.Contains([#"G/L Acct/BP Name"], "Water") then [#"G/L Acct/BP Name"] else null),
    #"Filtered Rows" = Table.SelectRows(#"Added Conditional Column1", each ([Posting Date] <> null)),
    #"Filled Down" = Table.FillDown(#"Filtered Rows",{"Code", "Item"}),
    #"Filtered Rows1" = Table.SelectRows(#"Filled Down", each ([Qty] <> null)),
    #"Reordered Columns" = Table.ReorderColumns(#"Filtered Rows1",{"Posting Date", "Code", "Item", "Document", "G/L Acct/BP Name", "Inventory UoM", "Qty"})
in
    #"Reordered Columns"


[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Posting Date[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Code[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Item[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Document[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]G/L Acct/BP Name[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Inventory UoM[/COLOR][COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]Qty[/COLOR]
02.08.18FG00017500 Litre Water Tank WhiteSI 2109Finished GoodsPcs
14​
02.08.18FG00017500 Litre Water Tank WhiteSI 2109Finished GoodsPcs
13​
02.08.18FG00017500 Litre Water Tank WhiteSI 2111Finished GoodsPcs
11​
02.08.18FG00017500 Litre Water Tank WhiteSI 2111Finished GoodsPcs
12​
02.08.18FG00018750 Litre Water Tank WhiteSI 2109Finished GoodsPcs
14​
02.08.18FG00018750 Litre Water Tank WhiteSI 2109Finished GoodsPcs
15​
02.08.18FG00018750 Litre Water Tank WhiteSI 2111Finished GoodsPcs
16​
02.08.18FG00018750 Litre Water Tank WhiteSI 2111Finished GoodsPcs
12​
02.08.18FG000191000 Litre Water Tank WhiteSI 2109Finished GoodsPcs
6​
02.08.18FG000191000 Litre Water Tank WhiteSI 2109Finished GoodsPcs
8​
02.08.18FG000191000 Litre Water Tank WhiteSI 2111Finished GoodsPcs
10​
02.08.18FG000191000 Litre Water Tank WhiteSI 2111Finished GoodsPcs
6​

<tbody>
</tbody>
It worked for me Thank you SO much and i learn a new tool as well
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,517
Members
448,968
Latest member
Ajax40

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