cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

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