+ Reply to Thread
Results 1 to 4 of 4

Counting the colored cells

  1. #1
    Registered User
    Join Date
    03-25-2013
    Location
    Gonzales, Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    1

    Counting the colored cells

    So I have been searching posts and reading about a few versions of VBA code used to count cells based on their color. Every version I have used gives me a #NAME error on the =CountColor(range,color) formula used in the cell returning the sum. I'm not sure if it is being caused by the data entered in the cells because when I define the range to count it shows all of those values in the formula assistant window. To be completely honest, my brain is "vapor locked" at this moment and I would like someone to show it to me on this spreadsheet I am working on for a friend. I can learn once I see what works and compare it to how I got it wrong. Is anyone willing to assist? The count should happen per row and I have put the desired result in the column on the right of the spreadsheet. The punchline here is she is looking to count the number of yellow cells per row.
    Attached Files Attached Files

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,451

    Re: Counting the colored cells

    Hi and welcome

    it's all explained at https://support.microsoft.com/en-us/kb/2815384 - Don't forget to save you file as xlsm

  3. #3
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    Sunderland, England
    MS-Off Ver
    Excel 2007 (Home) / 2003 (Work)
    Posts
    740

    Re: Counting the colored cells

    As the cells that are yellow are turned so because of specific rules, I'd recommend not going down the VBA route, but instead tweaking the conditional formatting and adding an extra 'Result' row.

    It's difficult to explain as I can't upload a file from work, but if you add a new row in row 6, call it RESULTS, and then put the result in each cell in the row as it happens.

    You can then use the following formula in column AS:
    =SUMPRODUCT(--(C7:AQ7=C$6:AQ$6))

    You can also then get rid of the individual conditional formatting on each column and replace it all with one rule to make the cell colouring all automatic, with the formula:
    =C7=C$6

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Counting the colored cells

    Try this UDF function
    you should highlight the cell (which will contain the formula) with the desired color
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Counting colored cells
    By Wskip49 in forum Excel General
    Replies: 4
    Last Post: 05-25-2015, 12:39 PM
  2. Counting colored cells
    By CarlosAndres in forum Excel General
    Replies: 5
    Last Post: 11-23-2012, 07:23 PM
  3. Counting Colored Cells
    By thakuromar in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 09-25-2012, 09:16 AM
  4. Counting colored cells
    By khank in forum Excel General
    Replies: 3
    Last Post: 01-08-2011, 06:23 PM
  5. Counting cells that are colored in
    By headbanger51 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-06-2008, 03:46 PM
  6. Counting colored cells
    By rarice in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-17-2006, 03:07 AM
  7. counting colored cells
    By James P in forum Excel General
    Replies: 2
    Last Post: 06-14-2006, 12:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1