formula to count commas

G

Guest

I have different multiples of 4 character strings delimited by commas in a
column of cells. I just need to count the commas so I can have the number of
multiples of 4 strings. For example, I could have ABCD, in cell one. In
cell 2 I could have ABCD,EFGH, in the next cell. In cell 3 I could have
ABCD,EFGH,IJKL,

I don't know what the string functions would be. But I need to count those
groupings of 4 characters.
Something like this?
count( left(4,","))

thanks,
 
P

Peo Sjoblom

To count commas


=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))


for range of cells


=SUMPRODUCT(LEN(A1:A10)-LEN(SUBSTITUTE(A1:A10,",","")))
 
G

Guest

mucho gracias

Peo Sjoblom said:
To count commas


=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))


for range of cells


=SUMPRODUCT(LEN(A1:A10)-LEN(SUBSTITUTE(A1:A10,",","")))
 
D

Don Guillett

One way if ONLY groupings of 4

Sub countwords()
tc = 0
For Each c In Range("h1:h6")
If Len(c) > 3 And InStr(c, ",") > 4 Then
x = 1
Else
x = 0
End If
mc = Len(c) - Len(Application.Substitute(c, ",", "")) + x
MsgBox mc
tc = tc + mc
Next c
MsgBox tc
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top