|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
使用PQ,无需VBA代码
- let
- Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
- #"Changed Type" = Table.TransformColumnTypes(Source,{{"No", Int64.Type}, {"Fruit", type text}}),
- #"Grouped Rows" = Table.Group(#"Changed Type", {"No", "Fruit"}, {{"CountQty", each Table.RowCount(_), Int64.Type}}),
- #"Pivoted Column" = Table.Pivot(#"Grouped Rows", List.Distinct(#"Grouped Rows"[Fruit]), "Fruit", "CountQty", List.Sum)
- in
- #"Pivoted Column"
复制代码 |
|