|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
说明:源数据应收款与已收款中的空白单元格需用0值填充,否则出错。
搞定 。
99.rar
(14.06 KB, 下载次数: 50)
- select
- "总计" as 客户名称,
- "总计" as 日期,
- "总计" as 摘要,
- (select sum(应收款) as 应收款 from [Sheet1$a1:e11]) as 应收款,
- (select sum(已收款) as 已收款 from [Sheet1$a1:e11]) as 已收款,
- (select sum(应收款)-sum(已收款) as 未收款 from [Sheet1$a1:e11]) as 未收款
- from
- [Sheet1$a1:e11]
- union
- select
- a.客户名称,
- a.日期,
- a.摘要,
- a.应收款,
- a.已收款,
- (select sum(应收款)-sum(已收款) as 未收款 from [Sheet1$a1:e11]b where a.客户名称=b.客户名称 and a.日期>=b.日期) as 未收款
- from
- [Sheet1$a1:e11]a
复制代码
[ 本帖最后由 masterexcel 于 2010-1-6 15:15 编辑 ] |
|