View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
L. Howard Kittle L. Howard Kittle is offline
external usenet poster
 
Posts: 698
Default sumif with color

Try this, where your range of cells has been named DataY.

Sub SumColorCountYellow()
Dim Yellow6 As Integer
Dim Cell As Range

For Each Cell In Range("DataY")
If Cell.Interior.ColorIndex = 6 Then
Yellow6 = Yellow6 + Cell.Value
End If
Next

Range("F1").Value = "Yellow = " & Yellow6

MsgBox " Yellow adds to " & Yellow6, _
vbOKOnly, "CountColor"

Range("F1").Value = ""

End Sub

HTH
Regards,
Howard

"reza" wrote in message
...
Hi all,

In 1 colom i have many numbers with many colors in cells. Can we sum with
specific color.
example.
1 ----(Yellow)
2 ----(Green)
3 ----(Yellow)
1 ----(Blue)
2 ----(Red)
with data above, can excel sum with only yellow cells???

thanks

reza