What is the quick way to transfer data from row to column

Sian1

Board Regular
Joined
Nov 9, 2009
Messages
90
Request ID101102104105116134135143147148149
R-042A04GC700000149
R-023A0DAB800000149
R-042A059Q100000143149
R-042A059Q100000
R-042A059Q100000
R-005A0HFX800001102105149
R-042A059Y400000104134149
R-042A059Y400000149
R-023A0BE0200000149
R-001A0Y3T700000134135
R-001A0Y3T700000116143147149
R-023A0BE0200000101
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
end results
Request IDRework Code
R-042A04GC700000149
R-042A059Q100000129
R-042A059Q100000143
R-042A059Q100000149
 
Upvote 0
It's unclear exactly what you are asking for. Can you explain with more detail?


Hi, what im trying to do is rearrange the data. as you see below table, the Request ID will still remain the same, however I would like the return the Row value (header) into the column. Hope you could help
 

Attachments

  • Capture 1.JPG
    Capture 1.JPG
    83.6 KB · Views: 11
  • Capture 2.JPG
    Capture 2.JPG
    137.6 KB · Views: 12
Upvote 0
Something like this?

Book1
ABCDEFGHIJKLMNOP
1Request ID101102104105116134135143147148149Request IDCountCode
2R-042A04GC700000149R-042A04GC7000001149
3R-023A0DAB800000149R-023A0DAB8000001149
4R-042A059Q100000143149R-042A059Q1000002143149
5R-042A059Q100000R-005A0HFX8000013102105149
6R-042A059Q100000R-042A059Y40000041.04134E+11
7R-005A0HFX800001102105149R-023A0BE02000002149101
8R-042A059Y400000104134149R-001A0Y3T70000061.34135E+17
9R-042A059Y400000149
10R-023A0BE0200000149
11R-001A0Y3T700000134135
12R-001A0Y3T700000116143147149
13R-023A0BE0200000101
Sheet1


Power Query Code
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Unpivot = Table.UnpivotOtherColumns(Source, {"Request ID"}, "Attribute", "Value"),
    Remove = Table.RemoveColumns(Unpivot,{"Attribute"}),
    Group = Table.Group(Remove, {"Request ID"}, {{"Count", each _, type table}}),
    Combo = Table.AddColumn(Group, "Code", each Text.Combine(List.Transform(Table.Column([Count],"Value"),Text.From),",")),
    Count = Table.TransformColumns(Combo,{"Count", each Table.RowCount(_)})
in
    Count
 
Upvote 0
I don't know why the 'Code' column is coming out like that on the forum. It's supposed to be comma separated strings of all the codes the request ID had attributed to it.
 
Upvote 0
I don't know why the 'Code' column is coming out like that on the forum. It's supposed to be comma separated strings of all the codes the request ID had attributed to it.
@lrobbo314, What version of XL2BB are you using as I get the below result...
It looks like version v1.0 whereas the current version is v1.2.6

Book1
ABCDEFGHIJKLMNOPQ
1Request ID101102104105116134135143147148149Request IDCountCode
2R-042A04GC700000149R-042A04GC7000001149
3R-023A0DAB800000149R-023A0DAB8000001149
4R-042A059Q100000143149R-042A059Q1000002143,149
5R-042A059Q100000R-005A0HFX8000013102,105,149
6R-042A059Q100000R-042A059Y4000004104,134,149,149
7R-005A0HFX800001102105149R-023A0BE02000002149,101
8R-042A059Y400000104134149R-001A0Y3T7000006134,135,116,143,147,149
9R-042A059Y400000149
10R-023A0BE0200000149
11R-001A0Y3T700000134135
12R-001A0Y3T700000116143147149
13R-023A0BE0200000101
Sheet5
 
Last edited:
Upvote 0
Something like this?

Book1
ABCDEFGHIJKLMNOP
1Request ID101102104105116134135143147148149Request IDCountCode
2R-042A04GC700000149R-042A04GC7000001149
3R-023A0DAB800000149R-023A0DAB8000001149
4R-042A059Q100000143149R-042A059Q1000002143149
5R-042A059Q100000R-005A0HFX8000013102105149
6R-042A059Q100000R-042A059Y40000041.04134E+11
7R-005A0HFX800001102105149R-023A0BE02000002149101
8R-042A059Y400000104134149R-001A0Y3T70000061.34135E+17
9R-042A059Y400000149
10R-023A0BE0200000149
11R-001A0Y3T700000134135
12R-001A0Y3T700000116143147149
13R-023A0BE0200000101
Sheet1


Power Query Code
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Unpivot = Table.UnpivotOtherColumns(Source, {"Request ID"}, "Attribute", "Value"),
    Remove = Table.RemoveColumns(Unpivot,{"Attribute"}),
    Group = Table.Group(Remove, {"Request ID"}, {{"Count", each _, type table}}),
    Combo = Table.AddColumn(Group, "Code", each Text.Combine(List.Transform(Table.Column([Count],"Value"),Text.From),",")),
    Count = Table.TransformColumns(Combo,{"Count", each Table.RowCount(_)})
in
    Count
hi, thanks :) it is close but i am more looking for the Unique code as the Power BI could distinct count the Request ID. I would like the return results like the table in the 2nd post.
 
Upvote 0
@lrobbo314, What version of XL2BB are you using as I get the below result...
It looks like version v1.0 whereas the current version is v1.2.6

Book1
ABCDEFGHIJKLMNOPQ
1Request ID101102104105116134135143147148149Request IDCountCode
2R-042A04GC700000149R-042A04GC7000001149
3R-023A0DAB800000149R-023A0DAB8000001149
4R-042A059Q100000143149R-042A059Q1000002143,149
5R-042A059Q100000R-005A0HFX8000013102,105,149
6R-042A059Q100000R-042A059Y4000004104,134,149,149
7R-005A0HFX800001102105149R-023A0BE02000002149,101
8R-042A059Y400000104134149R-001A0Y3T7000006134,135,116,143,147,149
9R-042A059Y400000149
10R-023A0BE0200000149
11R-001A0Y3T700000134135
12R-001A0Y3T700000116143147149
13R-023A0BE0200000101
Sheet5
hi, thanks :) it is close but i am more looking for the Unique code as the Power BI could distinct count the Request ID. I would like the return results like the table in the 2nd post. do you have any suggestions?
 
Upvote 0
So, just this then?

Book1 (version 2).xlsb
AB
1Request IDCode
2R-042A04GC700000149
3R-023A0DAB800000149
4R-042A059Q100000143
5R-042A059Q100000149
6R-005A0HFX800001102
7R-005A0HFX800001105
8R-005A0HFX800001149
9R-042A059Y400000104
10R-042A059Y400000134
11R-042A059Y400000149
12R-042A059Y400000149
13R-023A0BE0200000149
14R-001A0Y3T700000134
15R-001A0Y3T700000135
16R-001A0Y3T700000116
17R-001A0Y3T700000143
18R-001A0Y3T700000147
19R-001A0Y3T700000149
20R-023A0BE0200000101
Sheet12


Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    unpivot = Table.UnpivotOtherColumns(Source, {"Request ID"}, "Code", "Value"),
    selectColumns = Table.SelectColumns(unpivot,{"Request ID", "Code"}),
    Type = Table.TransformColumnTypes(selectColumns,{{"Request ID", type text}, {"Code", Int64.Type}})
in
    Type
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,879
Messages
6,122,065
Members
449,064
Latest member
scottdog129

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