Count the number cells that have been conditionally formatted in a cell range?

FrancisM

Board Regular
Joined
Apr 12, 2016
Messages
139
I have a worksheet that tracks leave taken. Cells in the range D4:Q29 fill with RGB,251,191,143, when it is <today. The range covers a 2 week pay period, therefor a 26 pay period year. I am trying to write a formula that counts the number of days till the last day in the last pay period, minus the weekend & 10 holidays. Is it possible to use only a formula & no VBA?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Re: Is it possible to count the number cells that have been conditionally formatted in a cell range?

A formula cannot detect cell colour, but you can use the CF rules to work out how many comply.
 
Upvote 0
Re: Is it possible to count the number cells that have been conditionally formatted in a cell range?

I have used CF in the past, but never to do anything, like this. Could you go into a little more detail, & explain how to accomplish this?
 
Upvote 0
Re: Is it possible to count the number cells that have been conditionally formatted in a cell range?

As Fluff says you should really count when the condition is true but maybe the macro below will suffice (no testing done)...

Code:
Sub CountRgb()
    Dim i As Long, myCell As Range
    i = 0
    For Each myCell In Range(" D4:Q29")
        If myCell.DisplayFormat.Interior.Color = RGB(251, 191, 143) Then i = i + 1
    Next
    MsgBox i
End Sub
 
Upvote 0
Re: Is it possible to count the number cells that have been conditionally formatted in a cell range?

Give Mark's code a try, or show us the CF formula
 
Upvote 0
Re: Is it possible to count the number cells that have been conditionally formatted in a cell range?

I want to thank Fluff & the group for their assistance. I decided to use Countif.
 
Upvote 0
Re: Is it possible to count the number cells that have been conditionally formatted in a cell range?

Glad you got it sorted & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,525
Messages
6,125,325
Members
449,218
Latest member
Excel Master

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