[mso] Re: once more COUNTIF ?

  • From: "Greg Chapman" <greg@xxxxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Mon, 15 Sep 2003 22:09:08 -0500

Well, you were paying attention. Your final assertion that COUNTIF will
not do what you're after in a single cell is correct. Now, I don't know
which function you would use to do that but I know how I would approach
the problem with VBA:

Sub HowManyEsNMinuses()

arrSplit = Split(LCase(Range("A1").Value), "-")
Range("A2").Value = UBound(arrSplit)

arrSplit = Split(LCase(Range("A3").Value), "e")
Range("A4").Value = UBound(arrSplit)

End Sub

Using your two examples and assuming the first was placed in cell A1 and
the second in A3, you'd get 2 in A2 and 4 in A4.

Greg Chapman
http://www.mousetrax.com 
"Counting in binary is as easy as 01, 10, 11!
With thinking this clear, is coding really a good idea?"


> -----Original Message-----
> From: mso-bounce@xxxxxxxxxxxxx 
> [mailto:mso-bounce@xxxxxxxxxxxxx] On Behalf Of Robert Carneal
> Sent: Monday, September 15, 2003 10:16 PM
> To: mso@xxxxxxxxxxxxx
> Subject: [mso] once more COUNTIF ?
> 
> 
> One more time please, my head is spinning from the COUNTIF 
> posts. I did not 
> keep it straight.
> 
> If A1 contains as text "1801-05-19", can I do this in Cell AA1?
> @countif(A1,"-")
> and get 2 as a result? (I don't think so, I think the correct 
> usage for 
> COUNTIF is:
> 
> COUNTIF (A1:A6,"-") will tell me how many cells contain the 
> "-", right?
> 
> I am looking for a method to the number of occurances of a 
> character in one 
> cell. For example if I have "Mattie Lee Bell" in A1, and I 
> want to count 
> how many "e"s there are, COUNTIF will not do the job for me, 
> or will it?

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: