|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
也可以直接通过SQL语句,不配合数据透视表来实现。SQL语句为:- select A.工号,A.产品线,A.姓名,sum(A.工资) as 工资,sum(A.福利2) as 福利,sum(A.社保) as 社保,sum(A.人工成本汇总) as 人工成本汇总, sum(A.人工成本汇总)/count(*) as 月平均工资 from (
- select *,"1月" as 月份,1*(0&福利) as 福利2 from [1月$] union all
- select *,"2月",1*(0&福利) from [2月$] union all
- select *,"3月",1*(0&福利) from [3月$] union all
- select *,"4月",1*(0&福利) from [4月$] union all
- select *,"5月",1*(0&福利) from [5月$] union all
- select *,"6月",1*(0&福利) from [6月$] union all
- select *,"7月",1*(0&福利) from [7月$] union all
- select *,"8月",1*(0&福利) from [8月$] union all
- select *,"9月",1*(0&福利) from [9月$] union all
- select *,"10月",1*(0&福利) from [10月$] union all
- select *,"11月",1*(0&福利) from [11月$] union all
- select *,"12月" ,1*(0&福利)from [12月$] )A
- group by A.工号,A.产品线,A.姓名
复制代码 同时把SQL语句的可视操作也一起上传供参考。
|
|