英文:
Replacing values based on condition in Power Query
问题
我想将一些熟人值替换为关键词以特定值,将“google”和“searching google”都转换为“seo”。
我尝试过使用替换方法,但您应该指定所有要替换的值,这是不可行的。
如果有一个包含“contain”功能的解决办法,我认为会有所帮助,但我找不到它。
英文:
I want to replace some acquaintance values by keywords to specific value, converting both "google" and "searching google" to "seo"
I tried replace but you should specify all the values to replace with and that's not possible.
if there is a solution with "contain" function i think it would help but i couldn't find it.
答案1
得分: 2
[![输入图像描述][1]][1]
[![输入图像描述][2]][2]
[1]: https://i.stack.imgur.com/uEZDk.png
[2]: https://i.stack.imgur.com/aizvK.png
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Custom1 = Table.TransformColumns( Source, {{"Column1",(x)=> if Text.Contains(x, "google") then "seo" else x}})
in
Custom1
英文:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Custom1 = Table.TransformColumns( Source, {{"Column1",(x)=> if Text.Contains(x, "google") then "seo" else x}})
in
Custom1
答案2
得分: 0
你需要按照这个教程中的说明添加一个条件列- 这里
这基本上是一个简单的新条件列,具有如下图所示的if/else条件-
英文:
You need to add a conditional column as explained here in this tutorial- Here
This is basically a simple new conditional column with if/else condition as shown in this below image-
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论