这样应该可以了,你的这个货号中有重复壳,可以需要先做除重。
- let
- Source = Excel.CurrentWorkbook(){[Name="PN"]}[Content],
- #"Changed Type" = Table.TransformColumnTypes(Source,{{"PN", type text}}),
- #"Sorted Rows" = List.Distinct(List.Transform(Table.Sort(#"Changed Type",{{"PN", Order.Ascending}})[PN],each Text.Trim(_))),
- #"Converted to Table" = Table.FromList(#"Sorted Rows", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
- #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "PN"}}),
- #"Merged Queries" = Table.NestedJoin(#"Renamed Columns", {"PN"}, List, {"PN"}, "List", JoinKind.FullOuter),
- #"Expanded List" = Table.ExpandTableColumn(#"Merged Queries", "List", {"PN", "001007", "", "001015", "001017", "001020", "001021", "001023", "001039", "003754", "003772", "003773", "003775", "003777", "003778", "003839", "004125", "004517", "004702", "004812", "004839", "005120", "005901", "006554", "006666", "006783", "007511", "007885", "007894", "007906", "008442", "011872", "012999"}, {"PN.1", "001007", "Column1", "001015", "001017", "001020", "001021", "001023", "001039", "003754", "003772", "003773", "003775", "003777", "003778", "003839", "004125", "004517", "004702", "004812", "004839", "005120", "005901", "006554", "006666", "006783", "007511", "007885", "007894", "007906", "008442", "011872", "012999"})
- in
- #"Expanded List"
复制代码
|