Posts by proengineer

    Re: Conditional count based on cell value and color


    The user colors the cell as needed.
    I use a function to count the cells that are set to whatever color i need.
    Here is the color counting function:

    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 Count = True Then
    For Each rCell In rRange
    If rCell.Interior.ColorIndex = lCol Then
    vResult = WorksheetFunction.Count(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

    I use this to count the cells with the correct part # =COUNTIFS('4-21-11'!H:H,"=102688-01")
    But I cant figure out how to make the cell color and the part # both the conditions to count.

    Re: Conditional count based on cell value and color


    Equipment Model NumberPart #Part #Model # only in yellowSL280UH110V60100870-01100870-01& =How many timesG61MPV-60C-090-12100870-03100870-02& =How many timesG60UHV-36A-070-07100870-03100870-03& =How many timesG60DFV-36A-070-07100870-02SL280UH110V60100870-03G60UHV-36B-090-07100870-03G61MPV-60C-091-10100870-03All I want to do is look up and count the conditions where both there is a part # and a yellow cell for that part #.G61MPV-60C-110-10100870-03G61MPV-60C-110-07100870-03G60UHV-60C-110X-07100870-01G60UHV-36A-070-10100870-02SL280UH110V60100870-03G61MPV-60C-110-07100870-03