### Title

Need to count each digit in a field

### Post

Hello everyone,

If I have a field that has the following values:

15184964313154

I need to count each of the numerical values only

1=4

3=2

4=3 and so forth

Thanks -J

Need to count each digit in a field

Hello everyone,

If I have a field that has the following values:

15184964313154

I need to count each of the numerical values only

1=4

3=2

4=3 and so forth

Thanks -J

Your field is a Number or Text field? Where does the data come from? Can you count instances before it is aggregated?

What de the numbers represent? How many records are there? What version of FMP?

Is the count used for an infrequent report (temporary), or is the count of ones, twos an integral part of the data?

Yes but you will have multiple counts in a single field apparently.

Let ( f = YourField ;

List ( "0 = " & PatternCount ( f ; "0" ) ;

"1 = " & PatternCount ( f ; "1" ) ;

"2 = " & PatternCount ( f ; "2" ) ;

..continue this pattern til the digit "9"

) // list

) // letThis returns the count of each digit in a list with a return separating each listed result.

And how will you display those results? Separate calculations for each digit or did you have something else in mind?

Patterncount ( YourField ; "1" )

will return 4 when your field has the value you've shown as an example.