excel每列相同颜色单元格求和

Excel本身没有这种功能,需要借助宏来实现 。首先ALT+F11 , 右击sheet1建立模块双击输入代码:Function SumColor(rColor As Range, rSumRange As Range) Application.Volatile iCol = rColor.Interior.ColorIndex For Each rCell In rSumRange If rCell.Interior.ColorIndex = iCol Then vResult = WorksheetFunction.Sum(rCell) + vResult End If Next rCell SumColor = vResultEnd Function
【excel每列相同颜色单元格求和】
关闭VBA窗口回到excel,假设你的数据在A列,B1输入 =sumcolor(A1,A1:A15) 计算结果是A1:A15中颜色为A1单元格底色的数据之和 。

经验总结扩展阅读