How to extract only file name from folder path string in Excel?

J

JayKay

I need to extract the file names from folder path strings in a worksheet Cell
using Worksheet functions. The number of folder levels is variable:

\\test server\app1\Test Files\File Set1\Bin_S(A)

\\test server\app1\Test Files\File Set2\Test Case1\Full Regression
 
B

Bernie Deitrick

JayKay,

For a string in cell A1, array enter (enter using Ctrl-Shift-Enter) this formula

=RIGHT(A1,LEN(A1)-MAX((MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1)="\")*ROW(INDIRECT("1:" & LEN(A1)))))

HTH,
Bernie
MS Excel MVP
 

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

Top