Pulling just the filename

  • Thread starter Thread starter Cardinal
  • Start date Start date
C

Cardinal

I have a column in my spreadsheet that has a bunch of image names and
paths. Example: images/taapay-040.gif

Is there a way that I can pull out just the filename? This would make
things so much easier for me and save me a ton of editing. Thank you
very much.
 
=MID(A1,FIND("/",A1,LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))+1,255)

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
Oh boy, my fault - please forgive me. Your function worked perfectly
although I now realize that I left out one important item. Not all the
paths are the same. They might one level or several levels deep. All of
these are possibilites:

images/taasec-004.gif
data/images/taasec-004.gif

Thanks and sorry for forgetting this in my original post.
 
Or this.......

=MID(A1,FIND("s/",A1,1)+2,99)

Vaya con Dios,
Chuck, CABGx3
 
If the hyphen is common to all, try Data>Text to Columns with the hyphen as
delimiter.


Gord Dibben MS Excel MVP
 
=MID(A1,FIND("~",SUBSTITUTE(A1,"/","~",LEN(A1)-LEN(SUBSTITUTE(A1,"/",""))))+
1,255)

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
I have a column in my spreadsheet that has a bunch of image names and
paths. Example: images/taapay-040.gif

Is there a way that I can pull out just the filename? This would make
things so much easier for me and save me a ton of editing. Thank you
very much.

Download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/

Then use the formula:

=REGEX.MID(A1,"(?<=/)[^/]+$")

to return the last string that follows a "/"
--ron
 
Ron Rosenfeld wrote...
....
Then use the formula:

=REGEX.MID(A1,"(?<=/)[^/]+$")

to return the last string that follows a "/"

You don't need the assertion. The following is sufficient.

=REGEX.MID(A1,"[^/]+$")
 
Ron Rosenfeld wrote...
...
Then use the formula:

=REGEX.MID(A1,"(?<=/)[^/]+$")

to return the last string that follows a "/"

You don't need the assertion. The following is sufficient.

=REGEX.MID(A1,"[^/]+$")

Thanks.
--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top