ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to count occurence of multiple characters in a cell (https://www.excelbanter.com/excel-worksheet-functions/134075-how-count-occurence-multiple-characters-cell.html)

MLK

How to count occurence of multiple characters in a cell
 
Is there a way to count the occurences of multiple characters in a cell?
For example, the cell might contain: smith,john(1234), smith,mary(1234),
doe,john(2345), etc etc.

I would like to be able to count how many times (1234) appears in the cell.
I tried using LEN, but that only counts one character.

Mary-Lou

Bob Phillips

How to count occurence of multiple characters in a cell
 
=(LEN(A1)-LEN(SUBSTITUTE(A1,"1234","")))/LEN("1234")

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"MLK" wrote in message
...
Is there a way to count the occurences of multiple characters in a cell?
For example, the cell might contain: smith,john(1234), smith,mary(1234),
doe,john(2345), etc etc.

I would like to be able to count how many times (1234) appears in the
cell.
I tried using LEN, but that only counts one character.

Mary-Lou




Teethless mama

How to count occurence of multiple characters in a cell
 
=COUNTIF(A1:A100,"*1234*")


"MLK" wrote:

Is there a way to count the occurences of multiple characters in a cell?
For example, the cell might contain: smith,john(1234), smith,mary(1234),
doe,john(2345), etc etc.

I would like to be able to count how many times (1234) appears in the cell.
I tried using LEN, but that only counts one character.

Mary-Lou


MLK

How to count occurence of multiple characters in a cell
 
Thanks for your response, but I did try something like this, but this is a
cell range where I only need to count the occurences in 1 cell.

Thanks, Mary-Lou

"Teethless mama" wrote:

=COUNTIF(A1:A100,"*1234*")


"MLK" wrote:

Is there a way to count the occurences of multiple characters in a cell?
For example, the cell might contain: smith,john(1234), smith,mary(1234),
doe,john(2345), etc etc.

I would like to be able to count how many times (1234) appears in the cell.
I tried using LEN, but that only counts one character.

Mary-Lou


MLK

How to count occurence of multiple characters in a cell
 
Wonderful! This works exactly as I wanted.

Thank you very much, Mary-Lou.

"Bob Phillips" wrote:

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

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"MLK" wrote in message
...
Is there a way to count the occurences of multiple characters in a cell?
For example, the cell might contain: smith,john(1234), smith,mary(1234),
doe,john(2345), etc etc.

I would like to be able to count how many times (1234) appears in the
cell.
I tried using LEN, but that only counts one character.

Mary-Lou






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

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