+ Reply to Thread
Results 1 to 10 of 10

Count coloured cells

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    MS365 V2308
    Posts
    279

    Question Count coloured cells

    I have a list of numbers, some coloured and others not. I need a formula to count the number of coloured cells as there is a large amount of numbers. Any help please
    Last edited by ukphoenix; 10-29-2012 at 11:13 AM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Count coloured cells

    How did the numbers get colored in the first place?
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    MS365 V2308
    Posts
    279

    Re: Count coloured cells

    manually, but may well work on another process. only a few numabers are entered weekly which makes it managable, but need a tally at end of month and year

  4. #4
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    MS365 V2308
    Posts
    279

    Re: Count coloured cells

    as an addition can a formula be used to create another worksheet with matching numbers from month.
    example (hopefully)

    i have 3 worksheets with numbers 1 to 10000 on each of them numbers 1,5,7 on sheet1, 2,5,7 on sheet2, 3,5,4 on sheet3. Can a 4th sheet be produced to show that 5 shows on all and only 5, or is this moving into macros required?

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Count coloured cells

    Yes for this last question you need to post a seperate thread in the macros sub forum.

    Try

    Function COUNTCOLOR(rColor As Range, rCountRange As Range)
        Dim rCell As Range
        Dim iCol As Integer
        Dim Result
    
        Application.Volatile
    
        iCol = rColor.Interior.ColorIndex
    
        For Each rCell In rCountRange
            If rCell.Interior.ColorIndex = iCol Then
                Result = Result + 1
            End If
        Next rCell
        '=COUNTCOLOR(A1,BZ18:CZ29)
        'Where A1 houses the colour of choice (e.g. yellow)
        COUNTCOLOR = Result
    End Function

  6. #6
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    MS365 V2308
    Posts
    279

    Re: Count coloured cells

    Now u have totally thrown me as i know macros excist but have no idea how to enter them in workbooks...lol.....complete novice when it comes to macros sorry. Any easy way of instructing me how to enter it id be most apprecaitive

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Count coloured cells

    No problem.

    There are three types of macros: General, Sheet, and ThisWorkbook.

    This is a general macro
    • Copy macro from post above
    • Select Ctrl + F11 (Opens VBE)
    • Select Ctrl + R (Only if project tree on the left side of the screen is not open)
    • Select Insert on toolbar >> Module
    • Paste macro on right side of screen
    • Select Alt + Q (Closes the VBE and return you to Excel)

    Lets say your range is A1:H20 and the color you want to count first occurs in C3.

    In a open cell enter =COUNTCOLOR(C3,A1:H20)

    NOTE: A User Defined Function (UDF) will not recalculate all by itself; instead, Ctrl + Alt + F9

  8. #8
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    MS365 V2308
    Posts
    279

    Re: Count coloured cells

    Ok sorted that now counts the coloured cells thanx. But what of the matching numbers through the sheets whats the macro for generating a 4th sheet say with a list of matching numbers?

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Count coloured cells

    Are you speaking of post #4?

    If so, you need to create a new thread as it is a new topic.

  10. #10
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    MS365 V2308
    Posts
    279

    Re: Count coloured cells

    ok thanx for ur help, cheers

+ 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