View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
David Billigmeier
 
Posts: n/a
Default Sum cells in excel if shaded

You will need a UDF, the following will sum every cell if it has ANY color
shading (will ignore only the cells with no shading). Then, to implement,
use the following in any cell on your spreadsheet =SumHighlighted(A1:D100)...
change reference to fit your data.

Function SumHighlighted(rng As Range)
For Each rng In rng
If Not (rng.Interior.ColorIndex = xlNone) Then
Sum = Sum + rng
End If
Next
SumHighlighted = Sum
End Function
--
Regards,
Dave


"David" wrote:

How do I conditionally sum a set of cells if I have them highlighted?