How to calculate number of rows containing any colored cells?

Hol_dav

New Member
Joined
Jan 26, 2023
Messages
22
Office Version
  1. 365
Platform
  1. Windows
I am wondering if there is a VBA/macro that I can run to count the number of rows in my table that contain any colored cells?

My research seems to only turn up code for counting colored cells, but I need to count the entire row as 1, regardless of how many or what color cells are contained.

Please help me!
 
I cannot see how that error is being generated from the code I posted. I tested my code on XL2019 (I don't have access to a version of XL365 to test VBA code on) before I posted it and it worked fine for me... I just retested the code and it still works fine for me. Did you copy my code exactly as I posted it? I almost sounds like you omitted the Sub statement from my code as that would produce the error you are describing whenever you attempted to run a different macro.
Let me try again!
 
Upvote 0

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)
@Hol_dav , None of what I'm going to do involes VBA or macros. Although, I can attempt VBA it would take me forever and there are other experts here better than. me. What you're asking for can be done with conditional formatting. Getting a report of all the errors can also be done, but will take some time to get the formulas right. My formula skills are decent, but rusty.

I am going to take your updated comments regarding the columns and calcuation and summarize them again That will take more than a minute!

My only other question is how you manage this workbook. Will you bring new data into the workbook each month? Is it consistently formatted (column positions, etc..)? If you're having a new workbook each month, then you'll probably need to create a blank template with the formulas and conditional formatting.. and be sure to import it the same way each time. Power Pivot and Power Query may help in some instances (I am not an expert on those and cannot begin to tell you how to start that.) But those are long term questions.

Stay tuned for another message.
Hi Awoohaw, just following up on this. Totally get that the conditional formulas are a big lift, but at the very least, can you explain to me about templates? If I create a blank template with these formulas, you’re saying there is a way to import my report into the template?
 
Upvote 0
I'll be working on your conditional formatting in a few hours. To create a template would be copying the workbook with the conditional formating you want to keep, deleting the data that changes, and renaming it *.xlst. And you would save it in a folder where you know where it is.
 
Upvote 0
I'll be working on your conditional formatting in a few hours. To create a template would be copying the workbook with the conditional formating you want to keep, deleting the data that changes, and renaming it *.xlst. And you would save it in a folder where you know where it is.
Ok great. Then on a weekly basis, when I download the report from the ATS, do I just save the data into a new worksheet. Then manually copy the data onto the template and save again so that my conditional formatting applied?
 
Upvote 0
yes, I'm working on it now. its really complicated!
 
Upvote 0
Okay, because your workbook was so wide, I created a new workbook with only the columns that need the conditional formatting. Hopefully you can replicate in your workbook(s). Or build your workbook into this. But, I think the conditional formatting won't transfer with your copy so you need to put that in manually.
The conditional formating is only in the first 21 or so rows. I would suggest only putting in the first data row of your template, and then use format painter to copy the formatting down after youve done you paste.

In the following your data elements are to the left of the big dark columns. To the right are the true/false formulas I used to create the conditional format rules.

Additionally, I did not do any validation on the user names for the 2 person data entry lists for recruiters. There is probably a way to do that, but its beyond my formula skills.

the second "Status" column takes advantage of a filter based based on the Job Status Column.

The second worksheet has ranges used in the validations. If you need to add values to these ranges you need to update the names from the Name Manager in the Formulas Menu. The first column is truncated.

To Create a template,
Open a New workbook.
Copy the second worksheet ranges and name the the named ranges one worksheet.
Put your header information on the main sheet.
Add the conditional formatting rules to the first data row.

Save as .xlst file in a location you like.

You may want to make it read only.


Conditional Formating.xlsx
ABCDEFGHIJKLMNOPQR
1RecruitersJob Ref IDJob Creation DateService LinePractice Area/Campus/SSLJob StatusStatusCoordinatorsHiring ManagersRecruiters CheckCreation Date CheckJob Status CheckStatus CheckService Line CheckPractice Area/Campus/SSLCheck
2MeganR10101739/15/2022CREATEDOpenDeepFALSETRUEFALSEFALSETRUETRUE
3Chavon, DianeR10138169/20/2023CREATEDOpenStephenTRUETRUEFALSEFALSETRUETRUE
4R10106628/18/2022CREATEDOpenDestinyTRUETRUEFALSEFALSETRUETRUE
5GeorgeR10111738/24/2022CREATEDOpenDestinyTRUETRUEFALSEFALSETRUETRUE
6MeganR101408512/2/2022MediaMedia EffectivenessSOURCINGInternal HireYulingFALSEFALSEFALSETRUEFALSEFALSE
7Chavon, DianeR09954844/21/2022SolutionsON HOLDOpenSamuelTRUETRUETRUETRUEFALSETRUE
8MeganR09440183/26/2021SolutionsSolutions Ecosystem & Growth OperationsOFFEROpenMasakoFALSETRUEFALSEFALSEFALSEFALSE
9Chavon, DianeR09434103/24/2021MicrosoftMedia EffectivenessON_HOLDOn HoldGaryTRUETRUEFALSEFALSEFALSEFALSE
10Chavon, DianeREF20444N4/8/2022CreativeIntegrated ProductionCREATEDOpenBrookeFALSETRUEFALSEFALSEFALSEFALSE
11R10002055/24/2022MediaMedia EffectivenessON_HOLDOn HoldMichaelTRUETRUEFALSEFALSEFALSEFALSE
12R10089928/1/2022MediaPerformance MarketingON_HOLDOn HoldEricTRUETRUEFALSEFALSEFALSEFALSE
13R09603248/11/2021MicrosoftMedia EffectivenessON_HOLDOn HoldXiaoyuanTRUETRUEFALSEFALSEFALSEFALSE
14R09490605/11/2021CreativeClientOFFEROpenAshleyTRUETRUEFALSEFALSEFALSEFALSE
15R09926703/25/2022CreativeIntegrated ProductionOFFEROpenConcettaFALSEFALSEFALSE
16R09649139/28/2021MicrosoftMedia EffectivenessON_HOLDOn HoldChristinaFALSEFALSEFALSE
Complx Cond Frmtng wksht
Cell Formulas
RangeFormula
M2:M14M2=IF( COUNTA(TEXTSPLIT(A2,","))=2, IF(ISNUMBER(FIND("REF",B2,1))=FALSE,TRUE,FALSE), ISNUMBER(MATCH(A2,RecruiterNames,0))=FALSE)
N2:N14N2= OR( C2+90<TODAY(), C2>TODAY())
O2:O14O2=ISNUMBER(MATCH(F2,JobStatusNames,0))=FALSE
P2:P16P2=ISNUMBER(MATCH(G2,FILTER(StatusNamesToFilter,JobStatusFilter=F2),0))=FALSE
Q2:R16Q2=D2= ""
Named Ranges
NameRefers ToCells
JobStatusFilter='Compare Lists'!$G$2:$G$10P2:P16
JobStatusNames='Compare Lists'!$C$2:$C$8O2:O14
RecruiterNames='Compare Lists'!$A$2:$A$60M2:M14
StatusNamesToFilter='Compare Lists'!$H$2:$H$10P2:P16
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G2:G18Expression=ISNUMBER(MATCH(G2,FILTER(StatusNamesToFilter,JobStatusFilter=F2),0))=FALSEtextNO
F2:F21Expression=ISNUMBER(MATCH(F2,JobStatusNames,0))=FALSEtextNO
E2:E21Expression=E2= ""textNO
D2:D21Expression=D2= ""textNO
C2:C21Expression= OR( C2+90<TODAY(), C2>TODAY())textNO
A2:A21Expression=IF( COUNTA(TEXTSPLIT(A2,","))=2, IF(ISNUMBER(FIND("REF",B2,1))=FALSE,TRUE,FALSE), ISNUMBER(MATCH(A2,RecruiterNames,0))=FALSE)textNO



Conditional Formating.xlsx
ABCDEFGHI
1RecruiterNamesJobStatusNamesStatusNamesJobStatusFilterStatusNamesToFilter
2Megan SaundersCANCELLEDExternal HireCANCELLEDCancelled
3Sebastien ReynoldsCREATEDInternal HireCREATEDOpen
4John SmithFILLEDOn HoldFILLEDInternal Hire
5AdamINTERVIEWOpenFILLEDExternal Hire
6AdeelOFFERPipelineINTERVIEWOpen
7AletaON_HOLDOFFEROpen
8AlexanderSOURCINGON_HOLDOn Hold
9AmandaON_HOLDPipeline
10AmySOURCINGOpen
11Anabel
12Anthony
13Arielle
14Ashley
15Brianna
16Chavon
17Chris
18Corinna
19Cyndi
20Desiree
21Destiny
Compare Lists
Cells with Data Validation
CellAllowCriteria
H13List=$C$2:$C$8
 
Upvote 0
Okay, because your workbook was so wide, I created a new workbook with only the columns that need the conditional formatting. Hopefully you can replicate in your workbook(s). Or build your workbook into this. But, I think the conditional formatting won't transfer with your copy so you need to put that in manually.
The conditional formating is only in the first 21 or so rows. I would suggest only putting in the first data row of your template, and then use format painter to copy the formatting down after youve done you paste.

In the following your data elements are to the left of the big dark columns. To the right are the true/false formulas I used to create the conditional format rules.

Additionally, I did not do any validation on the user names for the 2 person data entry lists for recruiters. There is probably a way to do that, but its beyond my formula skills.

the second "Status" column takes advantage of a filter based based on the Job Status Column.

The second worksheet has ranges used in the validations. If you need to add values to these ranges you need to update the names from the Name Manager in the Formulas Menu. The first column is truncated.

To Create a template,
Open a New workbook.
Copy the second worksheet ranges and name the the named ranges one worksheet.
Put your header information on the main sheet.
Add the conditional formatting rules to the first data row.

Save as .xlst file in a location you like.

You may want to make it read only.


Conditional Formating.xlsx
ABCDEFGHIJKLMNOPQR
1RecruitersJob Ref IDJob Creation DateService LinePractice Area/Campus/SSLJob StatusStatusCoordinatorsHiring ManagersRecruiters CheckCreation Date CheckJob Status CheckStatus CheckService Line CheckPractice Area/Campus/SSLCheck
2MeganR10101739/15/2022CREATEDOpenDeepFALSETRUEFALSEFALSETRUETRUE
3Chavon, DianeR10138169/20/2023CREATEDOpenStephenTRUETRUEFALSEFALSETRUETRUE
4R10106628/18/2022CREATEDOpenDestinyTRUETRUEFALSEFALSETRUETRUE
5GeorgeR10111738/24/2022CREATEDOpenDestinyTRUETRUEFALSEFALSETRUETRUE
6MeganR101408512/2/2022MediaMedia EffectivenessSOURCINGInternal HireYulingFALSEFALSEFALSETRUEFALSEFALSE
7Chavon, DianeR09954844/21/2022SolutionsON HOLDOpenSamuelTRUETRUETRUETRUEFALSETRUE
8MeganR09440183/26/2021SolutionsSolutions Ecosystem & Growth OperationsOFFEROpenMasakoFALSETRUEFALSEFALSEFALSEFALSE
9Chavon, DianeR09434103/24/2021MicrosoftMedia EffectivenessON_HOLDOn HoldGaryTRUETRUEFALSEFALSEFALSEFALSE
10Chavon, DianeREF20444N4/8/2022CreativeIntegrated ProductionCREATEDOpenBrookeFALSETRUEFALSEFALSEFALSEFALSE
11R10002055/24/2022MediaMedia EffectivenessON_HOLDOn HoldMichaelTRUETRUEFALSEFALSEFALSEFALSE
12R10089928/1/2022MediaPerformance MarketingON_HOLDOn HoldEricTRUETRUEFALSEFALSEFALSEFALSE
13R09603248/11/2021MicrosoftMedia EffectivenessON_HOLDOn HoldXiaoyuanTRUETRUEFALSEFALSEFALSEFALSE
14R09490605/11/2021CreativeClientOFFEROpenAshleyTRUETRUEFALSEFALSEFALSEFALSE
15R09926703/25/2022CreativeIntegrated ProductionOFFEROpenConcettaFALSEFALSEFALSE
16R09649139/28/2021MicrosoftMedia EffectivenessON_HOLDOn HoldChristinaFALSEFALSEFALSE
Complx Cond Frmtng wksht
Cell Formulas
RangeFormula
M2:M14M2=IF( COUNTA(TEXTSPLIT(A2,","))=2, IF(ISNUMBER(FIND("REF",B2,1))=FALSE,TRUE,FALSE), ISNUMBER(MATCH(A2,RecruiterNames,0))=FALSE)
N2:N14N2= OR( C2+90<TODAY(), C2>TODAY())
O2:O14O2=ISNUMBER(MATCH(F2,JobStatusNames,0))=FALSE
P2:P16P2=ISNUMBER(MATCH(G2,FILTER(StatusNamesToFilter,JobStatusFilter=F2),0))=FALSE
Q2:R16Q2=D2= ""
Named Ranges
NameRefers ToCells
JobStatusFilter='Compare Lists'!$G$2:$G$10P2:P16
JobStatusNames='Compare Lists'!$C$2:$C$8O2:O14
RecruiterNames='Compare Lists'!$A$2:$A$60M2:M14
StatusNamesToFilter='Compare Lists'!$H$2:$H$10P2:P16
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G2:G18Expression=ISNUMBER(MATCH(G2,FILTER(StatusNamesToFilter,JobStatusFilter=F2),0))=FALSEtextNO
F2:F21Expression=ISNUMBER(MATCH(F2,JobStatusNames,0))=FALSEtextNO
E2:E21Expression=E2= ""textNO
D2:D21Expression=D2= ""textNO
C2:C21Expression= OR( C2+90<TODAY(), C2>TODAY())textNO
A2:A21Expression=IF( COUNTA(TEXTSPLIT(A2,","))=2, IF(ISNUMBER(FIND("REF",B2,1))=FALSE,TRUE,FALSE), ISNUMBER(MATCH(A2,RecruiterNames,0))=FALSE)textNO



Conditional Formating.xlsx
ABCDEFGHI
1RecruiterNamesJobStatusNamesStatusNamesJobStatusFilterStatusNamesToFilter
2Megan SaundersCANCELLEDExternal HireCANCELLEDCancelled
3Sebastien ReynoldsCREATEDInternal HireCREATEDOpen
4John SmithFILLEDOn HoldFILLEDInternal Hire
5AdamINTERVIEWOpenFILLEDExternal Hire
6AdeelOFFERPipelineINTERVIEWOpen
7AletaON_HOLDOFFEROpen
8AlexanderSOURCINGON_HOLDOn Hold
9AmandaON_HOLDPipeline
10AmySOURCINGOpen
11Anabel
12Anthony
13Arielle
14Ashley
15Brianna
16Chavon
17Chris
18Corinna
19Cyndi
20Desiree
21Destiny
Compare Lists
Cells with Data Validation
CellAllowCriteria
H13List=$C$2:$C$8
Thank you so much!! This is so extensive, I really appreciate the time you took to help me!! :) :)
 
Upvote 0
well, that's only half way through. Then you need to insert the vba that others have posted to count your colored cells.
And speaking of that. You may want to test all the color counting on a just a few rows. You need to make sure the color index number (If that is what it is called) can be recognized. If not you need to experiment and find out which colors to use.

But, now that you have these rules you can use them to create a count of errors per row and sum them.
 
Upvote 0
And, you're welcome. I enjoy excel challenges! I'm happy to have some of them result in practicable workbooks.
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,665
Members
449,091
Latest member
peppernaut

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