Here you go...try this:
Function CountMatchedCells(FindText As String, rRange As Range) As Integer
Dim cCell As Range
Dim iCtr As Integer
Application.Volatile
For Each cCell In rRange.Cells
If cCell.Value Like FindText Then
If cCell.MergeCells = True Then
iCtr = iCtr + cCell.MergeArea.Cells.Count
Else
iCtr = iCtr + 1
End If
End If
Next cCell
CountMatchedCells = iCtr
End Function
Then you can use wildcards in the FindText
Examples:
This formula counts areas that begin with "LFB" (notice the asterisk after LFR)
B21: =CountMatchedCells("LFB*",B1:B20)
and this one counts areas that contain "LFB"
B21: =CountMatchedCells("*LFB*",B1:B20)
Does that help?
Bookmarks