excel-formula

How to extract filename in path in cell excel (formul)?


I have paths in Excel column and I want extract filename in other cell without VBA.

/where/is/my/path/filename.txt

I would like extract "filename.txt"


Solution

  • Here's a concise solution. It splits the full path by "/" and then grabs the last occurrence.

    =CHOOSECOLS(TEXTSPLIT(A1,"/"),-1)
    

    If you want to get just the file path as well, assuming you put the filename in column C:

    =LEFT(A1,LEN(A1)-LEN(C1))