Power Query: transpose column to one comma seperated cell

tombamber

New Member
Joined
Mar 28, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hi

I have a list of 4 digit numbers in a column in Power Query, for example:

1234

3827

3845

4028

3957


The file is refreshed with a new list each week with a differing amount of numbers.

I want PQ to combine them so they end up in a single cell in the following format.

1234,3827,3845,4028,3957

Any help would be appreciated.

Thanks
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Is your Power Query only referencing the one column? Or are there multiple columns in the Power Query?
 
Upvote 0
Can I ask why you want this format. Are you using it to migrate data to another tool, or are you using it in Excel this way?
 
Upvote 0
Is your Power Query only referencing the one column? Or are there multiple columns in the Power Query?
This query is a reference of another query with multiple columns. Those columns have been removed to leave this one column.
 
Upvote 0
One way would be to transpose your column of data and then combine the columns with a comma delimiter.
 
Upvote 0
Or using the group by function...

Assuming data looks like something below:
Col1Col2
A1234
A3827
A3845
B4028
B3957
C5487
C1248
C3258
C3333
A4847
A3214
B2014

This grouping
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Col1", type text}, {"Col2", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Col1"}, {{"Values", each Text.Combine([Col2], ", "), type nullable text}})
in
    #"Grouped Rows"
creates this table
1701007966188.png
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,115
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