cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
lala
Level IX

How can count the number of characters in a cell?

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

Recommended Articles