|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
感觉可以用SQL、PQ、VBA来解决,
我用了SQL方案供参考:
- SELECT 水表地址,卡号,用水年月,客户编码,起度,止度,实用水量,合计欠费
- FROM (
- SELECT 水表地址,卡号,用水年月,客户编码,起度,止度,实用水量,合计欠费 FROM [Sheet2(2)$a2:i4444] WHERE 水表地址 IN (SELECT 水表地址 FROM (SELECT 水表地址,水表地址+'小计' AS 水表地址小计,SUM(合计欠费) AS 合计欠费 FROM [Sheet2(2)$a2:i4444] GROUP BY 水表地址 HAVING SUM(合计欠费)>=200))
- UNION ALL
- SELECT 水表地址小计,'' AS 卡号,'' AS 用水年月,'' AS 客户编码,'' AS 起度,'' AS 止度,'' AS 实用水量,合计欠费 FROM (SELECT 水表地址,水表地址+'小计' AS 水表地址小计,SUM(合计欠费) AS 合计欠费 FROM [Sheet2(2)$a2:i4444] GROUP BY 水表地址 HAVING SUM(合计欠费)>=200))
- ORDER BY 水表地址
复制代码
|
|