0

Count the number of characters in a string

Hello,

 

I need to count the number of characters on a string, just like the LEN() function on excel.

 

I found a post with a similiar question with the following awnser:

"(...)  you can try the following to get the number of characters in the String: LASTINDEXOF( yourString , RIGHT( yourString , 1 ) )"

 

This formula makes a lot of sense! Unfortunatly, klipfolio is not following this logic... 

 

I have a table like this:



If i try "RIGHT ( list , 1)", it will show:

 

s

l

e

 

Wich is the propper way to show the last letter. 

However, if i use it like that LASTINDEXOF( list , RIGHT( list , 1 ) ), it will display:

87

43

51

 

You see, the first one is corret, but the second number is the last position of "s" in the second item, in the end of the word "dicaS". Same thing happens with the third one: 51 is the position of the last S, in the word "Steak". 

 

So, the LASTINDEXOF formula is only reading the RIGHT(list, 1) from the FIRST item. I need it to understand that "L" is the last letter for the second item and "E" is the last one for the third.

 

How can I fix that formula? Or is there another way i can do it?

 

Thanks

 

 

 



 

 

 

2 comments

  • Avatar
    Josh Cohen-Collier Official comment

    Hi Ivan,

    Thanks for posting in our community!


    The reason this is occurring is because the LASTINDEXOF function can only look at one string at a time.
    To get the results of more than one, you will need to use the MAP function.

    Best regards,
    Joshua

  • 1
    Avatar
    Scott Lawrence

    Hi Ivan,

    In case you had not yet seen it, we recently released a LENGTH function to count the number of characters in a string.  Would love any feedback on using it.

    Cheers,

    Scott.

Please sign in to leave a comment.