表格入门与提高吧 关注:12贴子:85
  • 3回复贴,共1

【知识点】如何对excel颜色统计以及求和

只看楼主收藏回复

按颜色统计的VBA自定义函数代码如下:
Function Countcolor(col As Range, countrange As Range)
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
按颜色求和的VBA自定义函数代码如下:
Function Sumcolor(col As Range, sumrange As Range)
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


IP属地:湖北1楼2015-07-11 22:49回复
    当然wps自带有这个功能,或者高版本Excel也有这个功能,或者用函数也可以解决,


    IP属地:湖北来自Android客户端2楼2016-01-21 13:23
    回复
      老大,看不懂


      IP属地:福建3楼2016-01-21 13:45
      回复
        可以申请吧主嘛


        IP属地:福建4楼2016-01-21 13:46
        回复