|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 ThxAlot 于 2021-6-29 08:23 编辑
复合判定条件一多,PQ的公式也就相应会复杂了,先用正则占个座,后续再来学习其他老师的PQ解法。
好像逻辑也不复杂
- let
- RE = (regex as text, str as text) =>
- let html = "<script>var regex = " & regex & ";var str = """ & str & """;var res = regex.test(str);document.write(res)</script>"
- in Web.Page(html)[Data]{0}[Children]{0}[Children]{1}[Text]{0} = "true",
- Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCjA1MNAyMlDSUQKiZzPXvWyYpRSrEw3iBfiYooq5mGKq8wg3AhtgoGUIQiTLY7MHLva8c+ezdV0IMRM9bCohomB+gGcAxCoMe5yNDBwxHecJ8j0QY3eWGZB8uqfp6d5FECOcoV7BUB0VhUvGJcXFGOQg9JCLBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [名称1 = _t, 名称2 = _t, 规格 = _t]),
- #"Added Custom" = Table.AddColumn(Source, "Custom", each if RE("/\b(hw|pip|([cd])(?!\2))/i", [名称1]) then [名称1] else if List.Contains({"特殊","异形"},[规格]) then [名称2] else "")
- in
- #"Added Custom"
复制代码
|
|