[mso] Formula needed that counts cells containing specified text and fill colour.

  • From: robert.allen-turl@xxxxxxxxxxxx
  • To: mso@xxxxxxxxxxxxx
  • Date: Sun, 1 Jul 2007 22:01:39 +0100

Apologies if this has been raised before but can't find an answer on 
Internet..
I need my Excel worksheet to count how many cells in a range contain a 
specified text and fill colour.

Range A1:A1000 contains a single letter in each cell - either "M" or "F" 
depending on gender and filled in either black or red..
To total the cells containing "M" I have the following array: 
{=SUMPRODUCT(IF(A1:A1000="M",1,0))}. This works perfectly.
I found a macro on www.brainbell.com/tutorials that counts how many cells 
are filled with a particular colour. Filling cell C1 in black or red as 
the criteria I put the following formula in C2: 
=ColorFunction(C1,A1:A1000,FALSE). This also works perfectly. 
I then tried merging the two working solutions to calculate how many cells 
in A1:a1000 are "M" AND filled in black as follows::
{=SUMPRODUCT(IF(A1:A1000="M",1,0),IF(ColorFunction(C1,A1:A1000,FALSE)))}

Needless to say it doesn't work. Any suggestions would be received 
gratefully.

Kind regards

Robert Allen-Turl 
Tel: +44 1455 272762 
Fax: +44 1455 271478 
Mobile: 07818 272762




*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the dropdown 
menu at the top.  This will allow you to unsubscribe your email address or 
change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to share files with the group, you must join our Yahoo sister group. 
 This group will not allow for posting of emails, but will allow you to join 
and share problem files, templates, etc.:  
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for FILE 
SHARING ONLY.

If you are using Outlook and you see a lot of unnecessary code in your email 
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************

Other related posts:

  • » [mso] Formula needed that counts cells containing specified text and fill colour.