View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Valy Greavu Valy Greavu is offline
external usenet poster
 
Posts: 3
Default Excel 2007: Can it SUMIF( ) using color as a condition ?

You cannot do a native sumif by colors.
You must create a VBA function for that.

Take a look he

Function SumCuloare(Culoare As Range, Casute As Range)

'Definirea variabilelor
Dim rrRange As Range
Dim sumColor As Long
Dim rrCasute As Range

'Definirea constantelor
sumColor = 0
Set rrCasute = Casute
vCuloare = Culoare.Font.Color

' Suma pe culori
For Each rrRange In rrCasute
If rrRange.Font.Color = vCuloare Then
sumColor = sumColor + rrRange.Cells.Value
End If
Next rrRange

' Returnare rezultat
SumCuloare = sumColor

End Function


You can see a sample on my blog:
http://valygreavu.wordpress.com/2010...ful-solutions/

--
Valy Greavu
MCP, MOS Expert


"Mr. Low" wrote:

Hi,

I understand that Excel 2007 can sort by colors. It is a great feature indeed.

May I know if =SUMIF( ) could use a color as the condition to sum up color
shaded cells or cells with certain font color?

Thanks

Low