I have paths in Excel column and I want extract filename in other cell without VBA.
/where/is/my/path/filename.txtI would like extract "filename.txt"
2 Answers
I share with you my finds.
I find this site :
=MID(A1,FIND("*",SUBSTITUTE(A1,"\","*",LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))))+1,LEN(A1))But doesn't work on french Excel that's why I translate for French users :
=STXT(A1;CHERCHE("$";SUBSTITUE(A1;"/";"$";NBCAR(A1)-NBCAR(SUBSTITUE(A1;"/";""))))+1;NBCAR(A1))I change "\" to "/" because I have unix path.
This will help:
var url = "/where/is/my/path/filename.txt";
var filename = url.substring(url.lastIndexOf('/')+1);
alert(filename);