Power Query 删除包含特定数值的字符串值

huangapple go评论77阅读模式
英文:

Power Query Remove Values with specific values in the string

问题

I am trying to remove the value of the person's surname if the string contains any of the following values "Ltd","Limited","LLP","T/A","Plc".

The code I have built turns all of the surnames into errors, and I am struggling to understand why. Any assistance would be greatly appreciated.

= Table.TransformColumns(
"Move Company Names to New Column",
{{"Person Surname",
each if Text.Length(_) > 20 or
List.MatchesAny({"Ltd","Limited","LLP","T/A","Plc"}, (s)=> Text.Contains([Person Surname], s, Comparer.OrdinalIgnoreCase)) then null
else _}})

英文:

I am trying to remove the value of the person's surname if the string contains and of the following values "Ltd","Limited","LLP","T/A","Plc".

The code I have built so turns all of the surnames into errors and I am struggling to understand why. Any assistance would be greatly appreciated.

= Table.TransformColumns(
#"Move Company Names to New Column", 
{{"Person Surname",
each if Text.Length(_) > 20 or 
List.MatchesAny({"Ltd","Limited","LLP","T/A","Plc"}, (s)=> Text.Contains([Person Surname], s, Comparer.OrdinalIgnoreCase)) then null 
else _}})

Power Query 删除包含特定数值的字符串值

答案1

得分: 2

= Table.TransformColumns(
#"Move Company Names to New Column",
{{"Person Surname",
每个人如果Text.Length() > 20或
List.MatchesAny({"Ltd","Limited","LLP","T/A","Plc"}, (s)=> Text.Contains(
, s, Comparer.OrdinalIgnoreCase))则为null
否则_}})

英文:
= Table.TransformColumns(
#"Move Company Names to New Column", 
{{"Person Surname",
each if Text.Length(_) > 20 or 
List.MatchesAny({"Ltd","Limited","LLP","T/A","Plc"}, (s)=> Text.Contains(_, s, Comparer.OrdinalIgnoreCase)) then null 
else _}})

huangapple
  • 本文由 发表于 2023年7月6日 17:33:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76627434.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定