Excel formula to get string between 2 characters

非 Y 不嫁゛ 提交于 2019-12-06 07:32:54

Try this:

=TRIM(MID(A2, 6, FIND("-",A2,6) - FIND("-",A2) - 2))

If hard coded 6 is not ok, you can replace it with FIND("-", A2) + 1.

You can get help from the following link, its pretty useful,,

http://www.mrexcel.com/forum/excel-questions/444266-extract-string-between-two-characters.html

Angel R. Bejarano

I used this and worked.

=IF(ISERROR(SUBSTITUTE(TRIM(LEFT(SUBSTITUTE(MID(A3,FIND("|",SUBSTITUTE(A3,"-","|",1))+1,LEN(A3)),"-",REPT(" ",LEN(A3))),LEN(A3)))," ","")),"",SUBSTITUTE(TRIM(LEFT(SUBSTITUTE(MID(A3,FIND("|",SUBSTITUTE(A3,"-","|",1))+1,LEN(A3)),"-",REPT(" ",LEN(A3))),LEN(A3)))," ",""))

you will get:

Blue Widgets
Green
Red

is you want to get the last part, I mean the string after the second "-" use this

=IF(ISERROR(SUBSTITUTE(TRIM(LEFT(SUBSTITUTE(MID(A3,FIND("|",SUBSTITUTE(A3,"-","|",2))+1,LEN(A3)),"-",REPT(" ",LEN(A3))),LEN(A3)))," ","")),"",SUBSTITUTE(TRIM(LEFT(SUBSTITUTE(MID(A3,FIND("|",SUBSTITUTE(A3,"-","|",2))+1,LEN(A3)),"-",REPT(" ",LEN(A3))),LEN(A3)))," ",""))

you will get:

Net
Grass
Apples

Best regads.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!