|
- Function SumC(Sum_range, ColorCell, Optional ColorId_Type = 0)
- Dim i%, arr, n%, Sm#
- C_Index = ColorCell.Interior.ColorIndex
- For i = 1 To Sum_range.Cells.Count
- If Sum_range.Cells(i).Interior.ColorIndex = C_Index Then
- Sm = Sm + Sum_range.Cells(i) '求和
- n = n + 1 '个数
- If ColorId_Type = 1 Then '最大
- D_Sz = Sum_range.Cells(i)
- If D_Sz > SumC Then SumC = D_Sz
- ElseIf ColorId_Type = 2 Then '最小
- D_Sz = Sum_range.Cells(i)
- If n = 1 Then SumC = D_Sz
- If D_Sz < SumC Then SumC = D_Sz
- End If
- End If
- Next
- If ColorId_Type = 0 Then
- SumC = Sm '和
- ElseIf ColorId_Type = 3 Then
- SumC = Sm / n '平均
- ElseIf ColorId_Type = 4 Then
- SumC = n '个数
- End If
- End Function
复制代码
写了些基本的,凑个数吧 |
评分
-
查看全部评分
|