+ Reply to Thread
Results 1 to 6 of 6

Counting - Color of cell and words in the cell

Hybrid View

  1. #1
    Registered User
    Join Date
    04-26-2011
    Location
    USAs
    MS-Off Ver
    Excel 2007
    Posts
    32

    Counting - Color of cell and words in the cell

    So I know how to do each of these separately. For example, if I want to count cells that contain a shade of blue, I use the VBA function
    =SUMPRODUCT(--(COLORINDEXOFRANGE(Sheet1!E:E,FALSE,1)=COLORINDEXOFONECELL(Sheet1!A1,FALSE,1)))
    which counts any cells in row E that match the color in cell A1.

    For certain words in a cell, I use the function
    =COUNTIF(Sheet1!E:E,"=ABCD")
    which counts any cell in row E that contains 'ABCD'.

    But despite all my efforts, I cant figure out a way to combine both of these. I want to count all cells that are the shade of blue in A1, but also contain 'ABCD'. I've tried COUNTIFS and SUMPRODUCT and a few others but can't get it to work. Any help would be much appreciated

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Counting - Color of cell and words in the cell

    Should be

    =SUMPRODUCT(--(COLORINDEXOFRANGE(Sheet1!E:E,FALSE,1)=COLORINDEXOFONECELL(Sheet1!A1,FALSE,1)),--(Sheet1!E:E,"=ABCD"))
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    04-26-2011
    Location
    USAs
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Counting - Color of cell and words in the cell

    I'm getting an error when I try that...

  4. #4
    Registered User
    Join Date
    04-26-2011
    Location
    USAs
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Counting - Color of cell and words in the cell

    I attached a sample workbook where I tried that... said that the function isnt valid when I copy/pasted it into this workbook.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Counting - Color of cell and words in the cell

    You cannot use VBA functions in a cell. I assumed that COLORINDEXOFRANGE and COLORINDEXOFONECELL were User Defined Functions (VBA based). Is this the case?

  6. #6
    Registered User
    Join Date
    04-26-2011
    Location
    USAs
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Counting - Color of cell and words in the cell

    Quote Originally Posted by ChemistB View Post
    You cannot use VBA functions in a cell. I assumed that COLORINDEXOFRANGE and COLORINDEXOFONECELL were User Defined Functions (VBA based). Is this the case?
    Correct. I'm using the functions from this site.
    http://www.cpearson.com/excel/colors.aspx

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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