Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have read many posts on how to Count cells with fill color and how
to sum based on fill color but how do you do an average? Here is the code I have now. Function AVGColor(rColor As Range, Range As Range) Dim rCell Dim iCol As Integer Dim C As Range Dim vResult As Double iCol = rColor.Interior.ColorIndex For Each rCell In Range If rCell.Interior.ColorIndex = iCol Then vResult = WorksheetFunction.Sum(rCell, vResult) End If Next rCell For Each C In Range If C.Interior.ColorIndex = rColor.Interior.ColorIndex Then Count = Count + 1 End If Next C If AVGColor = vResult / Count = Numeric Then AVGColor = vResult / Count Else: AVGColor = "" End If End Function Thanks for the help, Jay |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find monthly average but have average automatically configured | Excel Discussion (Misc queries) | |||
average cells, show 0 if nothing to average | Excel Discussion (Misc queries) | |||
Error Handling #N/A with AVERAGE Function - Average of values in Row | Excel Worksheet Functions | |||
Weighed Average of a weiged average when there are blanks | Excel Discussion (Misc queries) | |||
how does one convert text to a formula "average(A:A)" to =average( | Excel Worksheet Functions |