Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 360
Default formula to count commas

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,
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default formula to count commas

To count commas


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


for range of cells


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


--
Regards,

Peo Sjoblom



"Janis" wrote in message
...
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,



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 360
Default formula to count commas

mucho gracias

"Peo Sjoblom" wrote:

To count commas


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


for range of cells


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


--
Regards,

Peo Sjoblom



"Janis" wrote in message
...
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,




  #4   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default formula to count commas

another way would be
=(len(a1)+1)/5
would give the number of 4 letter groups

"Janis" wrote:

mucho gracias

"Peo Sjoblom" wrote:

To count commas


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


for range of cells


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


--
Regards,

Peo Sjoblom



"Janis" wrote in message
...
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,




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default formula to count commas

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
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Janis" wrote in message
...
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,


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add commas to the result of a formula with a text operator? jlrichman Excel Discussion (Misc queries) 3 April 22nd 23 04:08 AM
So many commas Alan[_5_] Excel Worksheet Functions 2 May 24th 07 07:44 PM
Count values between commas jhicsupt Excel Discussion (Misc queries) 4 April 3rd 07 09:13 PM
Count Commas in Cells Dax Arroway Excel Discussion (Misc queries) 5 January 30th 07 08:22 PM
Removing commas Ernie Sersen Excel Worksheet Functions 1 December 13th 04 05:15 PM


All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"