Formula to Count Highlighted Cells

Yevette

Active Member
Joined
Mar 8, 2003
Messages
336
All,

I've seen many posts on this, but no exact / clear answer. Is there an Excel formula (not VBA) that can count conditionally formatted highlighted (yellow) cells? Or, is this not a function Excel can perform? I am using Excel 2007.

Thanks so much for your help!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
All,

I've seen many posts on this, but no exact / clear answer. Is there an Excel formula (not VBA) that can count conditionally formatted highlighted (yellow) cells? Or, is this not a function Excel can perform? I am using Excel 2007.

Thanks so much for your help!
If the cells are conditionally formatted then you should be able to write a formula that uses the same logic as the CF rule to get a count.

You haven't provided any details so that's the best I can offer!
 
Upvote 0
Thank you for your reply,

I have certain cells (fields) in my spreadsheet that are (conditionally) formatted to highlight in yellow if the user fails to input data in the cell (mandatory fields). I am looking for a formula that will count the number of highlighted cells and if that number is greater than 0 that means the user did not complete form. I would put that formula in a cell and reference the cell in my VBA Code to give the User an error if they try to save the file without completing the mandatory fields. I have a working VBA code but now just need to be able to count the cells. Does that adequately clarify what I'm trying to do?

Thanks so much for your help.
 
Upvote 0
Thank you for your reply,

I have certain cells (fields) in my spreadsheet that are (conditionally) formatted to highlight in yellow if the user fails to input data in the cell (mandatory fields). I am looking for a formula that will count the number of highlighted cells and if that number is greater than 0 that means the user did not complete form. I would put that formula in a cell and reference the cell in my VBA Code to give the User an error if they try to save the file without completing the mandatory fields. I have a working VBA code but now just need to be able to count the cells. Does that adequately clarify what I'm trying to do?

Thanks so much for your help.
Ok, so what's the CF rule you used to turn the cells yellow?

It sounds like you can just do a count of EMPTY cells?
 
Upvote 0
Cells are in range B122:F126. If cells in Col. B. are populated, so must the cells in C:F be populated. For example, AND(B122 <>"",C122="") ---> cell C122 is highlighted yellow.
 
Upvote 0
Cells are in range B122:F126. If cells in Col. B. are populated, so must the cells in C:F be populated. For example, AND(B122 <>"",C122="") ---> cell C122 is highlighted yellow.
OK, I think this is what you're looking for:

=SUMPRODUCT((B122:B126<>"")*(C122:F126=""))
 
Upvote 0
Hmmm. That didn't work. To test it I ensured there were 2 highlighted cells. The result of the fomula is 0. Could that be because the cells also have data validation (all of the cells in that range have drop-down lists).
 
Upvote 0
Hmmm. That didn't work. To test it I ensured there were 2 highlighted cells. The result of the fomula is 0. Could that be because the cells also have data validation (all of the cells in that range have drop-down lists).
What did you do to ensure there were 2 highlighted cells?
 
Upvote 0
Hi,

It appears I had an issue with Excel. It locked up and shut down on me so I just had to reboot. Once I rebooted and tried your formula again, it worked!

Thanks so much for your help! I really appreciate your time and patience!
 
Upvote 0
Hi,

It appears I had an issue with Excel. It locked up and shut down on me so I just had to reboot. Once I rebooted and tried your formula again, it worked!

Thanks so much for your help! I really appreciate your time and patience!
You're welcome. Thanks for the feedback! :cool:
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,283
Members
452,902
Latest member
Knuddeluff

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