View Single Post
  #2  
Old May 27th, 2010, 09:21 PM posted to microsoft.public.excel.worksheet.functions
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default macrio soft exel

There is no built-in excel function to do this. But you can use a UDF that
looks at the range and returns the sum of color. But that function will not
recalculate if you change color. Every time you change the color you will
need to recalculate or wait excel to recalculate...

To install the UDF (User Defined function). From workbook launch VBE using
Alt+F11. From menu Insert a Module and paste the below function.Close and get
back to workbook and try the below formula.

Function COLORCOUNT(varRange As Range, varColor As Range)
Dim cell As Range
For Each cell In varRange
If cell.Interior.ColorIndex = varColor.Interior.ColorIndex Then
ColorCount = ColorCount + 1
End If
Next
End Function

To use the as a formula in range A1:J1 try the below; which will count the
number of cells colored same as cell A2....The second argument denotes the
colored cell.

=COLORCOUNT(A1:J1,A2)

--
Jacob (MVP - Excel)


"dheeraj sharma" wrote:

sir i want to find that ,in the row of an exel sheet if i hilighted one or
more one cell then i want to count that cell how?i can found ?