cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

How can count the number of characters in a cell?

lala
Level VIII

For example, how to count the number of line names with the first character of the name?

Thanks!

2020-12-28_16-32-43.png

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User


Re: How can count the number of characters in a cell?

If I understand correctly what you want to do (calculate character count for the first character in name) you could do it with something like this:

  1. Get length of the name -> Length(:name)
  2. Remove first character from the name -> Substitute(:name, Left(:name, 1), "")
  3. Get length of the string where first character is removed -> Length(previous part)
  4. And finally calculate difference between these two strings

 

Length(:name) - Length(Substitute(:name, Left(:name, 1), ""))

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User


Re: How can count the number of characters in a cell?

If I understand correctly what you want to do (calculate character count for the first character in name) you could do it with something like this:

  1. Get length of the name -> Length(:name)
  2. Remove first character from the name -> Substitute(:name, Left(:name, 1), "")
  3. Get length of the string where first character is removed -> Length(previous part)
  4. And finally calculate difference between these two strings

 

Length(:name) - Length(Substitute(:name, Left(:name, 1), ""))

 

-Jarmo
Craige_Hales
Super User


Re: How can count the number of characters in a cell?

Clever! (And comment your code if you use this, the next person will appreciate explaining what you are doing!)

Craige