发布网友 发布时间:2022-04-30 06:34
共3个回答
热心网友 时间:2023-10-19 14:25
你好:2010以上版本的,可以直接筛选,我这是2003,要启用的宏,按下图做,就可能统计有颜色的单元格了。
Option Explicit
Function CountColor(col As Range, countrange As Range) As Integer
Dim icell As Range
Application.Volatile
For Each icell In countrange
If icell.Interior.ColorIndex = col.Interior.ColorIndex Then
CountColor = CountColor + 1
End If
Next icell
End Function
Function SumColor(col As Range, sumrange As Range) As Integer
Dim icell As Range
Application.Volatile
For Each icell In sumrange
If icell.Interior.ColorIndex = col.Interior.ColorIndex Then
SumColor = Application.Sum(icell) + SumColor
End If
Next icell
End Function
红色的单元格下边G2填入公式:=countcolor(D$1,$A$1:$A$10)
更多WPS办公软件教程,请访问:http://bbs.wps.cn或者http://e.weibo.com/wpswfw
热心网友 时间:2023-10-19 14:25
你好:2010以上版本的,可以直接筛选,我这是2003,要启用的宏,按下图做,就可能统计有颜色的单元格了。
Option Explicit
Function CountColor(col As Range, countrange As Range) As Integer
Dim icell As Range
Application.Volatile
For Each icell In countrange
If icell.Interior.ColorIndex = col.Interior.ColorIndex Then
CountColor = CountColor + 1
End If
Next icell
End Function
Function SumColor(col As Range, sumrange As Range) As Integer
Dim icell As Range
Application.Volatile
For Each icell In sumrange
If icell.Interior.ColorIndex = col.Interior.ColorIndex Then
SumColor = Application.Sum(icell) + SumColor
End If
Next icell
End Function
红色的单元格下边G2填入公式:=countcolor(D$1,$A$1:$A$10)
更多WPS办公软件教程,请访问:http://bbs.wps.cn或者http://e.weibo.com/wpswfw
热心网友 时间:2023-10-19 14:26
WPS好象没这功能。。。试试OFFICE2007以上版本。热心网友 时间:2023-10-19 14:26
筛选下拉——颜色筛选——红色,如图:
效果图:
热心网友 时间:2023-10-19 14:26
WPS好象没这功能。。。试试OFFICE2007以上版本。热心网友 时间:2023-10-19 14:26
筛选下拉——颜色筛选——红色,如图:
效果图: