How do I count cells with a specific cell shading?

M

Mistermond

That works a treat! Thanks.
However, I have an additional complication in that I only want to count
cells of a specific colour AND with non-zero values. I'm afraid my VBA isn't
up to it!
Any idea?
Ray Mount
 
B

Bob Phillips

It is counted by VBA, the VBA returns an array of matching colours, it is
the SP formula. So use something like

=SUMPRODUCT(--(C1:C1000<>0),--(ColorIndex(C1:C1000)=Colorindex(A1))

where A1 is coloured with your test colour.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
M

Mistermond

Spot one once again!
Thanks very much - it has saved me a lot of effort now and in the future.
Ray Mount
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top