+ Reply to Thread
Results 1 to 4 of 4

Count and provide value of colored cells in a row

  1. #1
    Registered User
    Join Date
    12-04-2012
    Location
    At my desk
    MS-Off Ver
    2010
    Posts
    9

    Count and provide value of colored cells in a row

    Suppose I have a file with many rows of data, some cells are colored (flagged with an error), in several columns C, D, E, F, & G. Not all cells are colored in each row. However I would like to add a column at the end that captures a count if a cell in the row is colored.

    Referring to the attached example... I would expect a value of 1 in G3, 1 in H4, 1 in F6, 1 in H7, 1 in D8 and E8.

    Appreciate all and any help! Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Count and provide value of colored cells in a row

    There isn't a default function that can do this, but it can be done with a UDF.

    To add this to your worksheet, in Excel hit Alt+F11, Insert -> Module, and paste this code in there.

    Please Login or Register  to view this content.
    This gives you a new function called ColorFunction. The parameters are =COLORFUNCTION(a cell with the color you're looking for, the range, True for SUM or False for Count)

    So, in your workbook in F2 I put:

    =ColorFunction($C$6,[@[Job Name]],FALSE) since C6 is orange, and I want a count of the cells not the sum of their values.

    Then I just dragged that formula down and over.
    Attached Files Attached Files
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    12-04-2012
    Location
    At my desk
    MS-Off Ver
    2010
    Posts
    9

    Re: Count and provide value of colored cells in a row

    Thank you daffodil11..... Works like a charm. Correct me if I'm wrong but it appears that if I modify a cell (flag another after applied function)... I need to reapply the function in order to see the correct counts - right? Or did I miss something; is there a way to automate the update?

    Thanks again -- very helpful!

  4. #4
    Registered User
    Join Date
    08-02-2013
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Count and provide value of colored cells in a row

    Quote Originally Posted by daffodil11 View Post
    There isn't a default function that can do this, but it can be done with a UDF.

    To add this to your worksheet, in Excel hit Alt+F11, Insert -> Module, and paste this code in there.

    Please Login or Register  to view this content.
    This gives you a new function called ColorFunction. The parameters are =COLORFUNCTION(a cell with the color you're looking for, the range, True for SUM or False for Count)

    So, in your workbook in F2 I put:

    =ColorFunction($C$6,[@[Job Name]],FALSE) since C6 is orange, and I want a count of the cells not the sum of their values.

    Then I just dragged that formula down and over.
    I am not gonna lie, Daffodil11, that is more than a little awesome. Gonna use this as well.

+ 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. Count certain texts in cells and provide percentage overall
    By JaynRW in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-16-2014, 10:01 AM
  2. Replies: 1
    Last Post: 11-09-2013, 02:43 AM
  3. COUNT (or SUM?) colored cells
    By beanpoddy in forum Excel General
    Replies: 2
    Last Post: 03-27-2012, 01:14 PM
  4. Can you provide a conditional formula with colored cell change
    By DannyCog in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 03-01-2011, 11:56 AM
  5. count colored cells
    By apx2001 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-09-2006, 01:00 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