conditional formatting

RTE

Board Regular
Joined
Jul 24, 2008
Messages
60
I conditionally formatted 10 performance indicators for several institutions to identify the top 20% performers. How do I count the number of times an institution is in the top 20% (count conditionally formatted cells for institution)? Had to use a formula in the conditional formatting dialog box.

About out of options. Thanks.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Maybe this is an option.

Code:
Function COUNTCOLOR(rColor As Range, rCountRange As Range)
    Dim rCell  As Range
    Dim iCol   As Integer
    Dim Result

    Application.Volatile

    iCol = rColor.Interior.ColorIndex

    For Each rCell In rCountRange
        If rCell.Interior.ColorIndex = iCol Then
            Result = Result + 1
        End If
    Next rCell
    '=COUNTCOLOR(A1,BZ18:CZ29)
    'Where A1 houses the colour of choice (e.g. yellow)
    COUNTCOLOR = Result
End Function

And you could also look at
http://www.cpearson.com/excel/colors.aspx
 
Upvote 0
I'm presuming your data range has names in column A and scores in column B.

You can set up a formula to identify a threshhold for top 20% (e.g., 80 is the minimum to be in the top 20%) that would be something like:

=large($B$1:$B$100,count($B$1:$B$100)/5)

Then use the result of that to do your counting.

So, something like:

=sumproduct(--($A$1:$A$100=A1),--($B$1:$B$100>large($B$1:$B$100,count($B$1:$B$100)/5)))

...or if the large() formula is in cell C1 for instance, then:

=sumproduct(--($A$1:$A$100=A1),--($B$1:$B$100>$C$1))

Hope that helps - if not maybe show us a sample of your data.

Tai
 
Upvote 0
Jeff,

Also from Mr Pearson's website ( http://www.cpearson.com/excel/cfcolors.htm ):

"Unfortunately, the Color and ColorIndex properties of a Range don't return the color of a cell that is displayed if Conditional formatting is applied to the cell. Nor does it allow you to determine whether a conditional format is currently in effect for a cell. "

He does have some code on there for determining what colors are active in conditionally formatted cells, but I think it is much more complex than what you have in post 2...

Tai
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,877
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top