+ Reply to Thread
Results 1 to 8 of 8

Count column value then adjacent column cell fill color

Hybrid View

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

    Re: Count column value then adjacent column cell fill color

    Hi
    Try this udf function
    Function CountColorIf(ColorIndex As Long, rRange As Range, rCrit As Range, Optional SUM As Boolean)
        Dim rCell As Range
        Dim lCol As Long
        Dim vResult
        
        If SUM = True Then
            For Each rCell In rRange
                If rCell.Interior.ColorIndex = ColorIndex And rCell.Offset(0, -1) = rCrit Then
                    vResult = WorksheetFunction.SUM(rCell, vResult)
                End If
            Next rCell
        Else
            For Each rCell In rRange
                If rCell.Interior.ColorIndex = ColorIndex And rCell.Offset(0, -1) = rCrit Then
                    vResult = 1 + vResult
                End If
            Next rCell
        End If
        CountColorIf = vResult
    End Function
    In the attachment you will find help how to use it
    Attached Files Attached Files
    < ----- 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. Replies: 1
    Last Post: 07-20-2015, 10:58 AM
  2. [SOLVED] count number of cells in Column C that have a lesser or equal value to the adjacent cell
    By Geoff Jones in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-18-2013, 11:01 AM
  3. Replies: 1
    Last Post: 11-05-2013, 07:58 PM
  4. [SOLVED] Count Unique Values in a Column that are not in adjacent Column
    By sskgintl in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-15-2013, 03:18 PM
  5. Replies: 4
    Last Post: 10-21-2010, 11:05 AM
  6. Replies: 0
    Last Post: 03-09-2005, 06:47 AM
  7. Using COUNTIF to count column entries if adjacent column contains data
    By johnfullerroot in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-09-2005, 05:43 AM

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