ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   strings in a range (https://www.excelbanter.com/excel-worksheet-functions/108477-strings-range.html)

Peter Morris

strings in a range
 
what's a function I can use in VB to count the
number of times a particular string occurs in
a named range of cells?



Bob Phillips

strings in a range
 
Application.Countif(Range("myRange"),"string")

as an example

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Peter Morris" <nospam.ple@se wrote in message
. uk...
what's a function I can use in VB to count the
number of times a particular string occurs in
a named range of cells?





Peter Morris

strings in a range
 

"Bob Phillips" wrote in message
...
Application.Countif(Range("myRange"),"string")

as an example

--
HTH


That works.

also, is it possible to use wildcards in the search string?

Or to count the number of cells in the range with ANY
text in?



Tom Ogilvy

strings in a range
 
Application.Countif(Range("myRange"),"*string*)

Application.CountA(range("MyRange"))

--
Regards,
Tom Ogilvy


"Peter Morris" <nospam.ple@se wrote in message
. uk...

"Bob Phillips" wrote in message
...
Application.Countif(Range("myRange"),"string")

as an example

--
HTH


That works.

also, is it possible to use wildcards in the search string?

Or to count the number of cells in the range with ANY
text in?




Peter Morris

strings in a range
 

"Tom Ogilvy" wrote in message
...
Application.Countif(Range("myRange"),"*string*)

Application.CountA(range("MyRange"))

--
Regards,
Tom Ogilvy


Brilliant, much gratitude to both of you.




All times are GMT +1. The time now is 01:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com