I am trying to use excel power query to replace a word in a sentence.
For example, I would like to replace "South Korea" to "Korea"
Original:
| ID | Primary Location | Other Locations |
|---|---|---|
| 001 | United States | South Korea, Japan |
| 002 | United Kingdom | France, United States, South Korea |
| 003 | France | United Kingdom |
| 004 | Australia | Japan |
| 005 | Japan | South Korea |
After Power Query:
| ID | Primary Location | Other Locations |
|---|---|---|
| 001 | United States | Korea, Japan |
| 002 | United Kingdom | France, United States, Korea |
| 003 | France | United Kingdom |
| 004 | Australia | Japan |
| 005 | Japan | Korea |
I tried to use the
Table.ReplaceValue(#"Step1","South Korea","Korea",Replacer.ReplaceText,{"Other Locations"})
But it only gave me
| ID | Primary Location | Other Locations |
|---|---|---|
| 001 | United States | South Korea, Japan |
| 002 | United Kingdom | France, United States, South Korea |
| 003 | France | United Kingdom |
| 004 | Australia | Japan |
| 005 | Japan | Korea |
Are there ways that I can replace all the "South Korea" to "Korea" within the same column?
Thank you.
>Solution :
your syntax is perfect
= Table.ReplaceValue(#"Step1","South Korea","Korea",Replacer.ReplaceText,{"Other Locations"})
that means you have another error somewhere
(a) You sample columns says "Other Locations" your formula says "Other Location". They are not the same
(b) Maybe #"Step1" is not the name of the original data. Are you sure?
Right click the column and use replace text option. It will write the code for you