View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default How do I use the SumIF function with a criteria of a cell color?

Microsoft are not going to create a Volour fuynction, so write your own.

Function SumByColour(rng As Range, ci)
Dim cnt As Long
Dim cell As Range

Application.Volatile

For Each cell In rng

If cell.Interior.ColorIndex = ci Then

cnt = cnt + 1
End If
Next cell
SumByColour = cnt
End Function


and in you worksheet

=SumByColour(A1:A10,3)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Infernoo1" wrote in message
...
Hi,
I am trying to use the SumIF function and use a criteria based on the
color
of the cells. I see I can sort and filter based on cell color, but cannot
find how to add based on the cell color. Is this available, or do I need
to
wait for Microsoft to create a =color() function?