Tip for beginners: Remove first & last characters from text

Brass Contributor

You might be familiar with the LEFT & RIGHT functions, which always take a fixed number of characters from the left or right side of a piece of text.

 

However, if you want to remove a fixed number of characters this doesn't work, so we have to make it more dynamic with the LEN function.

 

The LEN function gives you the number of characters a piece of text has. 

 

So when we put it all together you can use this function, to remove the first 3 characters from a piece of text:

=RIGHT(A1, LEN(A1) - 3)

 

I also made a video with some more examples: https://www.youtube.com/watch?v=J3TNjJEvkMY

 

Do you know any other ways to get the same result? Perhaps easier or more robust?

3 Replies

@LouisDeconinck 

Another way to omit the first 3 characters is to use the MID function:

 

=MID(A1, 4, 1000)

 

The 1000 is just an arbitrary number greater than the expected length of the cell value. If you are certain that A1 will never have more than 10 characters, you could use

 

=MID(A1, 4, 7)

@LouisDeconinck 

If you want to omit - for example - the first 3 and last 2 characters:

 

=MID(A1, 4, LEN(A1)-3-2)

That's a creative approach especially, since it only requires one function.