Count Conditionally Formatted Colour in Table

_eNVy_

Board Regular
Joined
Feb 9, 2018
Messages
66
Office Version
  1. 365
Platform
  1. Windows
Is there any way to create a function in VBA that will count all red coloured cells in a Table?

My table, named Input has 11 columns and starts at cell A6 (A6 being the first column header). See attached screenshot.

Above columns, ID / Date of Birth / Delivery mechanism / Review reason / Significant event / Outcome, I would like a count of all the conditionally formatted red cells.

Not sure if it is important, but according to the More Colours section when choosing a colour within the Format.., Red : 255 / Green : 0 / Blue : 0 and the Hex code is #FF0000.

The purpose is to highlight and count the number of missing data.

Thank you in advance!
 

Attachments

  • Example tbl.png
    Example tbl.png
    20.5 KB · Views: 21

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I would like a count of all the conditionally formatted red cells.
What is the condition formatting rule that causes them to be red?
Often, that same rule can be adapted to count them.
 
Upvote 0
What is the condition formatting rule that causes them to be red?
Often, that same rule can be adapted to count them.
In the Edit Formatting Rule, Rule Type : Use a formula to determine which cells to format.
The formula used is :
Excel Formula:
=AND(ISNUMBER(A7),K7="")
A7 is the Row # where if there is any data in any of the cells along the same row, a number will populate.
The formula in this condition is applied similarly to the other columns, all referring to A7 (Row #).
 
Upvote 0
Upvote 0
You could use a formula like:

Excel Formula:
=SUMPRODUCT(ISNUMBER(A7:A100)*(K7:K100<>""))

adjusting the ranges to suit your data.
 
Upvote 0
Solution
You could use a formula like:

Excel Formula:
=SUMPRODUCT(ISNUMBER(A7:A100)*(K7:K100<>""))
To count the red (blank) cells, wouldn't that need to be
Excel Formula:
=SUMPRODUCT(ISNUMBER(A7:A100)*(B7:B100=""))

@_eNVy_
Since it appears your data is in a formal Excel table you could use something like this then you wouldn't ever have to worry about what number of rows is involved. Adjust the table name if required.

_eNVy_.xlsm
ABCDEF
4210
5
6Row #IDDate of BirthDate of DeathAge BandDelivery mechanism
71x
8216/08/1986y
9
10
11
Sheet1
Cell Formulas
RangeFormula
B4B4=COUNTIFS(Table1[Row '#],"<>",Table1[ID],"")
C4C4=COUNTIFS(Table1[Row '#],"<>",Table1[Date of Birth],"")
F4F4=COUNTIFS(Table1[Row '#],"<>",Table1[Delivery mechanism],"")


.. or a variation that you could just drag across the row, and then delete the formula from any columns that you don't want a count for.

_eNVy_.xlsm
ABCDEF
3210
5
6Row #IDDate of BirthDate of DeathAge BandDelivery mechanism
71x
8216/08/1986y
9
10
11
Sheet1
Cell Formulas
RangeFormula
B3B3=COUNTIFS(Table1[[Row '#]:[Row '#]],"<>",Table1[ID],"")
C3C3=COUNTIFS(Table1[[Row '#]:[Row '#]],"<>",Table1[Date of Birth],"")
F3F3=COUNTIFS(Table1[[Row '#]:[Row '#]],"<>",Table1[Delivery mechanism],"")
 
Upvote 0
You could use a formula like:

Excel Formula:
=SUMPRODUCT(ISNUMBER(A7:A100)*(K7:K100<>""))

adjusting the ranges to suit your data.
I swapped the
Excel Formula:
<>""
into
Excel Formula:
=""
as I needed to count how many blanks there are within the table.
But thank you very much. I was originally trying to incorporate a COUNTIFS and ISNUMBER.
I'm not all that comfortable with SUMPRODUCT.

Again, thank you. This does what I require.
 
Upvote 0
Looks like you are happy with the SUMPRODUCT approach but I wanted to correct my formulas because I forgot that column A actually contains a formula so my previous suggestions will not produce the correct results. Corrected versions of both types of formulas below.

BTW, I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

_eNVy_.xlsm
ABCDEF
3210
4210
5
6Row #IDDate of BirthDate of DeathAge BandDelivery mechanism
71x
8216/08/1986y
9
10
11
Sheet1
Cell Formulas
RangeFormula
B3B3=COUNTIFS(Table1[[Row '#]:[Row '#]],">0",Table1[ID],"")
C3C3=COUNTIFS(Table1[[Row '#]:[Row '#]],">0",Table1[Date of Birth],"")
B4B4=COUNTIFS(Table1[Row '#],">0",Table1[ID],"")
C4C4=COUNTIFS(Table1[Row '#],">0",Table1[Date of Birth],"")
F3F3=COUNTIFS(Table1[[Row '#]:[Row '#]],">0",Table1[Delivery mechanism],"")
F4F4=COUNTIFS(Table1[Row '#],">0",Table1[Delivery mechanism],"")
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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