Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
counting occurances of a char. within a text string/cell
Can anyone recommend a easy method for programmatically determining the
number of times a character occurs within a single cell (e.g., the character "*" occurs 5 times in text "A*B*C*D*E*F"). Thanks, Justin |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
counting occurances of a char. within a text string/cell
From a previous post...
Public Function GetCharCount(vString As String, CheckChar As String) as Integer Count=0 For n=1 to len(vstring) If mid(vstring,n,1)=CheckChar then Count = Count + 1 Next GetCharCount=Count End Function -- Regards, Bill Lunney www.billlunney.com "Justin Ater" wrote in message ... Can anyone recommend a easy method for programmatically determining the number of times a character occurs within a single cell (e.g., the character "*" occurs 5 times in text "A*B*C*D*E*F"). Thanks, Justin |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
counting occurances of a char. within a text string/cell
Justin,
Try something like NumChars = Len(S) - Len(Replace(S, "*", "")) where S is your string. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Justin Ater" wrote in message ... Can anyone recommend a easy method for programmatically determining the number of times a character occurs within a single cell (e.g., the character "*" occurs 5 times in text "A*B*C*D*E*F"). Thanks, Justin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Counting Text Occurances - HELP PLEASE | Excel Worksheet Functions | |||
How can I find a value from one cell in a char string in another? | Excel Worksheet Functions | |||
Counting # of occurances of words in text | Excel Worksheet Functions | |||
substituting two text occurances in same cell. | Excel Worksheet Functions | |||
Counting multiple occurances of a specific string | Excel Worksheet Functions |