excel按照颜色进行汇总的函数用法
时间:2022-10-29 12:48:41
Excel中的汇总函数具体该如何按照颜色进行计算呢?下面是由小编分享的excel按照颜色进行汇总的函数用法,以供大家阅读和学习。
excel按照颜色进行汇总的函数用法:
按照颜色进行汇总步骤1:在EXCEL界面中,按下组合键Alt + F11,弹出一个MicrosoftVisual Basic窗口。
按照颜色进行汇总步骤2:在窗口中,执行菜单操作:“插入”—>“模块”,如下图。
按照颜色进行汇总步骤3:看到一个“(通用)”的窗体,这个窗体就是用来输入VBA代码的窗体,如下图:
按照颜色进行汇总步骤4:将如下代码粘贴到该窗体中:
FunctionSumByColor(Ref_color As Range, Sum_range As Range)
Application.Volatile
Dim iCol As Long
Dim rCell As Range
SumByColor = 0
iCol =Ref_color.Interior.ColorIndex
For Each rCell InSum_range
If iCol = rCell.Interior.ColorIndex And WorksheetFunction.IsNumber(rCell) Then
SumByColor = SumByColor + rCell.Value
End If
Next rCell
End Function
结果如下图:
按照颜色进行汇总步骤5:关闭Microsoft VisualBasic窗口,返回到EXCEL窗口,函数SumByColor设置完毕。
设置完成的函数SumByColor(Ref_color, Sum_range),函数有2个参数:
第一个是要想统计颜色的单元格(任意一个与要汇总颜色相同的单元格均可),
第二个是要汇总的单元格区域。
如本例,在B16格中输入: =SumByColor(B15,B2:F13) 得出结果:1690748
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
wps表格怎么添加分页符? wps分页符的使用教程
![](https://img.aspxhome.com/file/2023/5/a166295_0s.png)
一键重装Win7系统用什么软件好?
![](https://img.aspxhome.com/file/2023/26/a227981_0s.png)
Win10系统无法启动Windows audio服务怎么办?
![](https://img.aspxhome.com/file/2023/26/a224862_0s.jpg)
win11摄像头微信没法视频聊天怎么解决?
![](https://img.aspxhome.com/file/2023/30/a271427_0s.jpg)
Win10 Mobile/PC累积更新14393.445正在微软内部测试
![](https://img.aspxhome.com/file/2023/28/a243229_0s.jpg)
电脑桌面设置“一键关机”快捷图标的解决方法
![](https://img.aspxhome.com/file/2023/3/a300923_0s.jpg)
怎样大小是合适PPT幻灯片字体
![](https://img.aspxhome.com/file/2023/10/a352973_0s.png)
mac系统中Safari浏览器网页怎么保存至备忘录Notes?
![](https://img.aspxhome.com/file/2023/4/a214804_0s.jpg)
如何用Deeper打开Mac程序里的显示完整工具栏?
![](https://img.aspxhome.com/file/2023/1/a214231_0s.jpeg)
Win8.1系统如何使用自带映像备份功能进行备份?
![](https://img.aspxhome.com/file/2023/28/a247177_0s.jpg)
如何调整微信小程序的顺序?整微信小程序顺序的方法
![](https://img.aspxhome.com/file/2023/8/a336382_0s.png)
wps ppt怎么关闭音乐
台式电脑怎么用U盘重装系统?系统之家U盘重装Win10教程
![](https://img.aspxhome.com/file/2023/1/a273177_0s.png)
iOS/iPadOS 14.5 Beta 6发布
![](https://img.aspxhome.com/file/2023/7/a207627_0s.jpeg)
笔记本提示“已连接电源适配器,电池未充电”怎么办?
![](https://img.aspxhome.com/file/2023/27/a235916_0s.jpg)
华硕电脑怎么进入pe模式?系统之家u盘制作pe系统启动盘教程
![](https://img.aspxhome.com/file/2023/30/a271309_0s.png)
希沃互动大屏应用技巧
![](https://img.aspxhome.com/file/2023/9/a342979_0s.jpg)
Win10 KB3119142补丁诡异:重复安装四五次往复循环
![](https://img.aspxhome.com/file/2023/28/a245862_0s.png)
MAC OS X如何设置SSH远程访问的快捷方式
![](https://img.aspxhome.com/file/2023/8/a216198_0s.jpg)
如何在Mac电脑中停用网络?
![](https://img.aspxhome.com/file/2023/1/a202831_0s.jpeg)