怎样用IF函数进行如下计算?老师
1。编写一个自定义函数colornumber();
Function colornumber(cell) As Integer
'此函数返回单元格文字颜色号,红色为3
Application。 Volatile True
colornumber = cell。Range("A1")。Font。ColorIndex
End Function
2。插入一列,写入公式,算出左边单元格的颜色值。 如:=colornumber(B2)。[假设是B2到B7单元格有有红色字符的数值]
复制此公式到需要的行。按F9执行此函数。
3。在插入行的最下列写公式,如:=sumif(C2:C7,3,b2:b7)...全部
1。编写一个自定义函数colornumber();
Function colornumber(cell) As Integer
'此函数返回单元格文字颜色号,红色为3
Application。
Volatile True
colornumber = cell。Range("A1")。Font。ColorIndex
End Function
2。插入一列,写入公式,算出左边单元格的颜色值。
如:=colornumber(B2)。[假设是B2到B7单元格有有红色字符的数值]
复制此公式到需要的行。按F9执行此函数。
3。在插入行的最下列写公式,如:=sumif(C2:C7,3,b2:b7)
即可对红色字符的单元格进行条件求和。
同理也可进行其他颜色字符数值的求和。
。收起