+ Reply to Thread
Results 1 to 2 of 2

Use Colorfunction and Subtotal togheter to count filtered coloured cells

  1. #1
    Registered User
    Join Date
    07-30-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    4

    Use Colorfunction and Subtotal togheter to count filtered coloured cells

    Hi all!

    I'm working on a spreadsheet and I managed to create a macro on VBA to count coloured cells as below:

    Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
    Dim rCell As Range
    Dim lCol As Long
    Dim vResult
    lCol = rColor.Interior.ColorIndex
    If SUM = True Then
    For Each rCell In rRange
    If rCell.Interior.ColorIndex = lCol Then
    vResult = WorksheetFunction.SUM(rCell, vResult)
    End If
    Next rCell
    Else
    For Each rCell In rRange
    If rCell.Interior.ColorIndex = lCol Then
    vResult = 1 + vResult
    End If
    Next rCell
    End If
    ColorFunction = vResult
    End Function


    And to use it I'm using the formula =colorfunction(A1;A12:A1459;FALSE), with A1 that is the coloured cell that I want to count.

    The next step is being able to count coloured cells that are filtered, like a Subtotal formula that could work with the colourfunction.

    Could you help me on this?

    Thank you very much,

    Domenico

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

    Re: Use Colorfunction and Subtotal togheter to count filtered coloured cells

    Try this
    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. How can I count coloured cells (coloured using Conditional Formatting)
    By franfry in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-15-2013, 02:40 PM
  2. [SOLVED] Using SUMPRODUCT and SUBTOTAL to count filtered results containing #N/A values
    By Powerslave in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-17-2013, 12:07 PM
  3. [SOLVED] Count coloured cells
    By ukphoenix in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-29-2012, 11:13 AM
  4. Count filtered cells using SUBTOTAL
    By Russell Dawson in forum Excel Tips
    Replies: 2
    Last Post: 07-15-2012, 03:39 PM
  5. Count coloured cells
    By SoqedHozi in forum Excel General
    Replies: 2
    Last Post: 11-04-2011, 06:49 AM
  6. Count coloured cells
    By laly in forum Excel General
    Replies: 3
    Last Post: 11-01-2009, 06:10 PM
  7. Count coloured Cells
    By shree in forum Excel General
    Replies: 2
    Last Post: 08-24-2006, 01:57 AM
  8. count coloured cells
    By ile in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-19-2006, 03:40 AM

Tags for this Thread

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