|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
自定义函数去匹配,供参考;根本原理上来说还是“数据明细” LEFT OUTER JOIN “引用表”的合并查询。
试了一下,合并查询的效率略高一些,约45s;写的函数合并近50s。
- let
- Source = Excel.CurrentWorkbook(){[Name="数据明细"]}[Content],
- #"Added Custom" = Table.AddColumn(
- Source,
- "Custom",
- each [
- RefTable = Table.Group(#"引用表", {"月份", "姓名"}, {{"AGGR", each _}}),
- LookUp = RefTable{[月份=Date.StartOfMonth(_[日期]), 姓名=_[姓名]]}[AGGR]{0}
- ][LookUp]
- ),
- #"Expanded Custom" = Table.ExpandRecordColumn(#"Added Custom", "Custom", {"其它1", "其它2", "其它3", "其它4"}, {"其它1", "其它2", "其它3", "其它4"})
- in
- #"Expanded Custom"
复制代码
|
|