Thank you Robert, Hector, Bob and Rick, I'm going to test out your options
tonight and will give you the results tomorrow. SORRY for not being more
specific and yes, I'm familiar with
VB.
--
Thank you...
"Robert Crandal" wrote:
I created a function below that should give you what you want.
You need to give the function a row value ("iRow"), how
many cells or columns to count ("n"), and tell it which
name or string to search for ("token").
So, you could use it like follows:
MsgBox "Total AAA's in Row1 a " & CountRowTokens(1, 6, "AAA")
Since it's also a function, you could probably use it as a formular in
the actual spreadsheet as well.
================================================== ======================
Public Function CountRowTokens(ByVal iRow As Integer, ByVal n As Integer,
ByVal token As String)
Dim i, cState, iState, nFull As Integer
If (Cells(iRow, 1).Value = token) Then
nFull = 1
cState = 1
Else
nFull = 0
cState = 0
End If
For i = 2 To n
If (Cells(iRow, i).Value = token) Then
iState = 1
Else
iState = 0
End If
If (iState < cState) Then
If (iState = 0) Then
cState = 0
Else
cState = 1
nFull = nFull + 1
End If
End If
Next i
CountRowTokens = nFull
End Function
================================================== ===========
.