Merge Columns IN Power Query with spacers

SimonHughes

Well-known Member
Joined
Sep 16, 2009
Messages
507
Office Version
  1. 365
Platform
  1. Windows
Hello, getting to grips with PQ and have just merged columns and got the top row (Get). What I want though is to insert text as shown in the second row (Want). I also tried to add a custom column and use the concatenate formula to insert text and spaces but I just got an error message. Can anyone help here? Many thanks.

Get-1;14;Back of house shower
WantLevel -1; Ref - 14; Location - Back of house shower
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
To avoid error messages, maybe you should first transform the column types to "text" in order to merge columns.
 
Upvote 0
Assuming you have -1, -14, Back of house shower as separate columns to start with, can't you simple use Transform > Format > Add Prefix to each of the 3 columns "BEFORE" you merge them ?

1723897313753.png


1723897395624.png
 
Upvote 0
Solution
Hi SimonHughes,
try after updating Source and Column Names.

Power Query:
= Table.TransformColumns(Source, {"Column2", each Text.Combine(List.Transform(List.Zip({{"Level ","Ref - ", "Location - "}} & {Text.Split(_,";")}), Text.Combine), "; ")})

Regards,
 
Upvote 0
Hi SimonHughes,
try after updating Source and Column Names.

Power Query:
= Table.TransformColumns(Source, {"Column2", each Text.Combine(List.Transform(List.Zip({{"Level ","Ref - ", "Location - "}} & {Text.Split(_,";")}), Text.Combine), "; ")})

Regards,
Hi Alex, I have not tried your suggestion as I found the solution above which seems a very easy and tidy way of doing it but many thanks for your input (I will look at what you suggest as it may prove useful in other scenarios).
 
Upvote 0
Hi Alex, yes, that is just what I wanted, works perfectly, many thanks

The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
I really thought I had as I appreciate that it is important to do so. Apologies.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

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