Excel根据字体颜色或背景色求和

 时间:2026-04-26 02:28:12

1、  选择【开发工具】 点击鬼粒【Visual Basic】

Excel根据字体颜色或背景色求和

2、 选择【sheet1】,右击物盯王,选择【插入】,选择【模块】

Excel根据字体颜色或背景色求和

3、写入代码

Function SumByFontColorAndBGColor(Col As Range, SumRange As Range) '根据字体颜色及背景颜色求和

Application.Volatile

Dim iCell As Range

SumByFontColorAndBGColor = 0

For Each iCell In SumRange

    If iCell.Font.Color = Col.Font.Color And iCell.Interior.Color = Col.Interior.Color Then

       躲侨     SumByFontColorAndBGColor = SumByFontColorAndBGColor + Application.WorksheetFunction.Sum(iCell)

    End If

Next

End Function

4、1.     = SumByFontColorAndBGColor(A3,A1:A12)

A3: 根据A3单元格的字体格式和背景色

A1:A12:查找的范围。

Excel根据字体颜色或背景色求和

  • Excel2019中怎么创建组?
  • vba进行状态栏和编辑栏的设置
  • Excel如何对带同一种颜色的单元格分别进行求和?
  • Excel函数详解:[140]HYPERLINK函数用法
  • Excel2019版本在哪时设置允许后台检查错误
  • 热门搜索
    迎国庆的手抄报 迎中秋庆国庆手抄报简单又漂亮 节约用水手抄报大全 关于校园的手抄报 爱国手抄报资料 语文手抄报大全 五一英语手抄报 我的家庭手抄报 三年级数学手抄报内容 安全伴我行手抄报图片