View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Darren Bartrup[_2_] Darren Bartrup[_2_] is offline
external usenet poster
 
Posts: 36
Default Parse File Location

If your file name is in cell A1 this will work:
=RIGHT(A1,LEN(A1)-FIND("?",SUBSTITUTE(A1,"\","?",LEN(A1)-LEN(SUBSTITUTE(A1,"\","")))))

Split down it does this:
1. Find the length of the full path
2. Remove the \ from the path and find the length of the string.
3. The difference is how many \'s are in the string.
4. Replace the last \ with a character that won't appear in a filename.
5. Cut off everything to the right of this.