Sum if cell green

  • Thread starter Thread starter Pat
  • Start date Start date
Hi
one way: use the following user defined function:
Public Function Sum_Color(rng as range,col_index)
Dim ret_value
Dim cell as range
For each cell in rng
If cell.interior.colorindex=col_index then
If IsNumeric(cell.value) then
ret_value = ret_value + cell.value
end if
end if
next
Sum_Col = ret_value
end Function

Call it in your worksheet with:
=SUM_COLOR(B5:B223,4)
 
Back
Top