PDA

View Full Version : Count Shaded Cells with a value of X in it


excelnewb
Oct 24, 2011, 09:41 AM
Hi, I need help with creating a function to count cells that are shaded and have a value of X in them in a range of selected cells. I have tried the several vba macros that count shaded cells but I need to to go one step further and only count the shaded cells that have a value within them such as X. Thanks

JBeaucaire
Oct 26, 2011, 04:39 PM
I would never implement a "coloring" method of counting. By whatever criteria you used to color the cells, I would make sure that criteria was properly reflected in the data and then create formulas that can assess the data the same way.

By that I mean, marking a row "paid" by coloring it green is a very human thing to do, but it's terrible data. There should be a column where that "paid" status is entered and thus easily referenced without super plumbing trying to analyze formatting.

Is that possible? Can you update your workbook to properly include all data exclusive of any colorizations?

Anyway, testing the value of a cell is easy. Other than "X", what would the other values be? It might be as simple as testing if the cell is blank or not. But testing for "X", very easy once the full context is seen.

Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook. See if you can manually demonstrate a logic of what rows to count that doesn't require color analysis, too. Why are the cells colored?