ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Counting number of time a character appears in a string (https://www.excelbanter.com/excel-worksheet-functions/51533-counting-number-time-character-appears-string.html)

Henrik

Counting number of time a character appears in a string
 
Does anyone know a way to automatically count how many times a certain
character counts in a text string?

Henrik

Counting number of time a character appears in a string
 
I meant to say:

Does anyone know a way to automatically count how many times a certain
character appears in a text string?

(i.e. "w" appears 3 times in the string above)




"Henrik" wrote:

Does anyone know a way to automatically count how many times a certain
character counts in a text string?


Harlan Grove

Counting number of time a character appears in a string
 
Henrik wrote...
Does anyone know a way to automatically count how many times a certain
character counts in a text string?


To count the number of Xs in s, try

=LEN(s)-LEN(SUBSTITUTE(s,"X",""))


Peo Sjoblom

Counting number of time a character appears in a string
 
=LEN(A1)-LEN(SUBSTITUTE(A1,"a",""))

will count the occurrence of a in cell A1, if you have a range with strings
use

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


--

Regards,

Peo Sjoblom

"Henrik" wrote in message
...
Does anyone know a way to automatically count how many times a certain
character counts in a text string?




Henrik

Counting number of time a character appears in a string
 
FYI, I figured it out:

=LEN(cell_ref)-LEN(SUBSTITUTE(cell_ref,"character",""))




"Henrik" wrote:

I meant to say:

Does anyone know a way to automatically count how many times a certain
character appears in a text string?

(i.e. "w" appears 3 times in the string above)




"Henrik" wrote:

Does anyone know a way to automatically count how many times a certain
character counts in a text string?


Ron Rosenfeld

Counting number of time a character appears in a string
 
On Thu, 20 Oct 2005 14:25:02 -0700, Henrik
wrote:

Does anyone know a way to automatically count how many times a certain
character counts in a text string?


To count the number of appearances of a character in a text string:

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


--ron


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

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