Reputation: 23
I have text in a cell which starts with [ and ends in ] and I want to show the text between these two characters.
So far I have this:
=LEFT(A2, SEARCH("]",A2)-1)
but it still shows as [1234. I just need to figure out how to remove the first [.
Upvotes: 1
Views: 2611
Reputation: 7891
There are several ways. If you know your string always starts with [
and ends with ]
then you could use:
=SUBSTITUTE(SUBSTITUTE(A2,"[",""),"]","")
If there may be text before [ and / or after ], then try:
=MID(A2,FIND("[",A2)+1,FIND("]",A2)-FIND("[",A2)-1)
Upvotes: 1
Reputation: 43595
If you want to "strip" the first and the last character, independently of what they are, you can do this:
=RIGHT(LEFT(RC[-1],LEN(RC[-1])-1),LEN(RC[-1])-2)
Upvotes: 0