Thread: Conditional Sum
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Abdul Shakeel Abdul Shakeel is offline
external usenet poster
 
Posts: 39
Default Conditional Sum

thanks for your reply but it is more difficult to call this formula with
colour number as I use several colours in my sheet could I use the colour
name instead

--
Regards,



"Mike H" wrote:

Hi,

You need a UDF for that. Try this one but note it doesn't work for
conditional format colours, that requires a different and much more
complicated method. Alt + F11 to open VB editor. Right click 'This workbook'
and insert module and paste ths code below in on the right.

Call with

=SumColour(A1:A20,6)
6 is yellow and if your not sure of the colours record a macro of yourself
colouring the cells to get the numbers.

Function SumColour(r As Range, iCol As Integer) As Long
For Each c In r
If c.Interior.ColorIndex = iCol And _
IsNumeric(c) Then
SumColour = SumColour + c.Value
End If
Next c
End Function

Mike

"Abdul Shakeel" wrote:

I wan to sum up values according to its font color....any idea??