Need formula to match text from one column to text in different worksheet and count the highlighted cells. This is similar to doing a sumif, but instead of returning a numerical value in a static column, I will return the count of highlighted cells.
I have successfully written the VBA to count the highlighted cells in a given column, but now must do a match of names. Meaning, if name in column A1:A50 matches name in Sheet2 Column J1:J52, then return a count of highlighted cells in sheet 2 column X.
Formula to count highlighted cells:  countbycolor('sheet2'!J4:J1847,A52)
VBA:
Function CountByColor(InputRange As Range, ColorRange As Range) As Long
    Dim cl As Range, TmpCount As Long, ColorIndex As Integer
    Application.Volatile
    ColorIndex = ColorRange.Interior.ColorIndex
    TmpCount = 0
    On Error Resume Next
    For Each cl In InputRange.Cells
    If cl.Interior.ColorIndex = ColorIndex _
        Then TmpCount = TmpCount + 1
    Next cl
    CountByColor = TmpCount
End Function