你的这个问题是Excel中比较高级的应用问题了。Excel本身没有根据颜色条件求和的公式,必须要用VBA。右击工作表标签--查看代码,打开VBA,添加如下代码:
Function SUMCOLOR(sumrange As Range, colorrang360问答e As Range, Optional fontorinterior As Boolean = False)
Dim iCell As Range
Dim TF As Boolean
Application.Volatile
For Each iCell In sumrange
If fontorinterior = True Then
TF = iCell.Interior.ColorIndex = colorrange.Interior.ColorIndex
Else
TF = iCell.Font.ColorIndex = colorrange.Font.ColorIndex
End If
If TF Then
SUMCOLOR = SUMCOLOR + Val(iCell)
End If
Next iCell
End Function
保存后关闭回到工作表中,在要按颜色求和的单元格中输入自定义函数的公式:
=SUMCOLOR(求和区域,有颜色的单元格)
找不到工作表标签?下面的“Sheet1”、“Sheet2”等就叫做工作表标签哟!