Conditional Formulas that ommit a certain color fill

PADWIS

New Member
Joined
Jun 4, 2010
Messages
3
I have a range with RED, GREEN and AMBER. I want to get a sum of the entire range but be able to NOT INCLUDE a certain color such as RED. I amd stuck on what to do. Can anyone get me going on this?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Welcome to the board.

Are the cells colored by conditional formatting?
If so, you can use the same (or opposite) logic from the conditional formatting formula.

Can you post the CF formulas that you have?
 
Upvote 0
use the ozgrid colorfunction and call into conditional format as a formula

Code:
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
    Dim rCell As Range
    Dim lCol As Long
    Dim vResult
 
     ''''''''''''''''''''''''''''''''''''''
     'Written by Ozgrid Business Applications
     'www.ozgrid.com
 
     'Sums or counts cells based on a specified fill color.
     '''''''''''''''''''''''''''''''''''''''
 
    lCol = rColor.Interior.ColorIndex
 
    If SUM = True Then
        For Each rCell In rRange
            If rCell.Interior.ColorIndex = lCol Then
                vResult = WorksheetFunction.SUM(rCell, vResult)
            End If
        Next rCell
    Else
        For Each rCell In rRange
            If rCell.Interior.ColorIndex = lCol Then
                vResult = 1 + vResult
            End If
        Next rCell
    End If
 
    ColorFunction = vResult
    Application.Volatile
End Function

then CF in cell looks like so
Code:
=AND(ColorFunction($A$1,I2,FALSE)

A1 is the reference cell for that formula
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,901
Members
452,948
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