replace this {";",":","!"} with a table in Power Query

Matt Allington

MrExcel MVP
Joined
Dec 18, 2014
Messages
1,629
Can anyone tell me how can a I replace a list of values such as {";",":","!"} that exists inside a function such as this

Text.Remove([Contents],{";",":","!"})

with a table of values (single column table). eg

ColumnHeader
;
,
:
!

I have tried creating the table above and then using it in the formula with Table.ToList() but that didn't work. I assume {";",":","!"} is just a list, but I could be wrong.

Thanks for any help.
 
Last edited:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
If the answer is not in the code below, then I didn't understand your question. Or in fact I didn't, but maybe the answer you are looking for is still in the code below.

Code:
let
    Source = {";",":","!"},
    Tabled = Table.FromList(Source),
    Custom1 = Table.ToList(Tabled),
    TextCleaned = Text.Remove("M;a;r:celBeug!!!!", Custom1)
in
    TextCleaned
 
Upvote 0
Thanks Marcel for your reply. I'm trying to do the opposite. I know I can write the source line as you have. I stead I want to load the list of values in a table (say Excel) and then use that as the source. Is this possible?
 
Last edited:
Upvote 0
List From Table in Excel:

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    ChangedType = Table.TransformColumnTypes(Source,{{"ColumnHeader", type text}}),
    List1= Table.ToList(ChangedType),
TextCleaned = Text.Remove("M;a;r:celBeug!!!!", List1)
in
    TextCleaned
 
Upvote 0
As it is a 1-column table, and a table column is a list, the code can be shortened to:

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    List1 = Source[ColumnHeader],
    TextCleaned = Text.Remove("M;a;r:celBeug!!!!", List1)
in
    TextCleaned
 
Upvote 0
Thanks both. I tried to do this with the UI but it didn't work. I will investigate again now with this working code. Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,225,726
Messages
6,186,674
Members
453,368
Latest member
xxtanka

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