Extracting File Name from string

AlanAnderson

Board Regular
Joined
Jun 7, 2010
Messages
134
Hi, me again ---:confused:

I need to extract a name out of a long, variable string. The problem is that I do not know what folders and subfolders will be in string nor do i know the exact length of the file name. If I did, then a simple right() would do it.
Examples of just three of the strings are:

C:\Wf\SavedQuotes\CustQuoteKKK777.xls
C:\Wf\SavedQuotes\2011-03-02 15-25-08\CustQuote123abcdef.xls
C:\Wf\2011-03-03 18-15-087\CustQuoteabcde66554.xls
(There is no way I can predict or restrict the folders or number of sub folders involved)

The only data I can depend on is that my filename will always start with CustQuote (unknown number of characters ) and end with .xls

In first example the answer i need to obtain is:

CustQuoteKKK777

The logic behind this is too much for me. Can someone please help?

Thanks,

Alan
Excel 2003 but must also work on later versions.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi Andrew,
That works like a dream - not sure I fully understand why but it is great.
Thank you so much.

Regards,

Alan
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,789
Members
452,942
Latest member
VijayNewtoExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top