Power Query Replacing more than one comma

hatstand

Well-known Member
Joined
Mar 17, 2005
Messages
764
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I have a file with varying amounts of words and commas in each row. To tidy things up and place one comma in front of every word (later to be split by delimiter). I am replacing every pair of commas with a single commas until the job is done. My problem is that it takes 20 lines as per below to get the job done. Is there a simpler method like a ",*". Obviously this won't work and I'm not up to speed with M code yet. Thanks for any pointers.

#"Replaced Value7" = Table.ReplaceValue(#"Replaced Value6",",,,,",",",Replacer.ReplaceText,{"Column1"}),
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Here's the M code for adding the new column.
Code:
Table.AddColumn(#"Changed Type", "ReplaceMultipleDelimiters", each ReplaceMultipleDelimiters([Column1], ","))

You could try incorporating that into the M code for the query that's pulling in the data.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

hatstand

Well-known Member
Joined
Mar 17, 2005
Messages
764
Office Version
  1. 2016
Platform
  1. Windows
No problem, I've changed it. Cheers.
 

Forum statistics

Threads
1,136,354
Messages
5,675,299
Members
419,560
Latest member
g3org

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
Top