我有一些VB,允许我基于细胞颜色COUNTIF;COUNTIF细胞颜色是XXX&条件格式
Function COUNTIFCOLOR(rSample As Range, rArea As Range) As Long
Dim rAreaCell As Range
Dim lMatchColor As Long
Dim lCounter As Long
lMatchColor = rSample.Interior.Color
For Each rAreaCell In rArea
If rAreaCell.Interior.Color = lMatchColor Then
lCounter = lCounter + 1
End If
Next rAreaCell
CountColorIf = lCounter
End Function
要使用这一点,你就简单的说
=COUNTIFCOLOR(A5,J2:J15)
随着A5作为参考这个颜色太一电池,和J2:J15被指望的范围内。
这有效,但是如果单元格已通过条件格式进行格式化,则它不包括返回的计数中的该单元格。
现在我被困=/
UDF参考[这里](http://www.excelfox.com/forum/f22/get-displayed-cell-color-whether-from-conditional-formatting-or-not-338/)可能是利益。 – pnuts 2015-04-02 11:44:27