ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Separating Location and Filename in a cell (https://www.excelbanter.com/excel-worksheet-functions/123834-separating-location-filename-cell.html)

Jim Jackson

Separating Location and Filename in a cell
 
I have a long list of Files which include the complete path. I need tro
separate the filename ("JohnDoe.xls") from the first part of the cell
("C:\Files\Clients\"). In some cells the path includes numerous subfolders
so the formula needs to take that into consideration.

I have seen workable formulas in this site but cannot, for the life of me,
find them now. Any and all help is greatly appreciated.
--
Best wishes,

Jim

Dave Peterson

Separating Location and Filename in a cell
 
One that I save <bg:

=MID(A1,1,LEN(A1)-FIND(CHAR(1),SUBSTITUTE(A1,"\",CHAR(1),LEN(A1)
-LEN(SUBSTITUTE(A1,"\","")))))



Jim Jackson wrote:

I have a long list of Files which include the complete path. I need tro
separate the filename ("JohnDoe.xls") from the first part of the cell
("C:\Files\Clients\"). In some cells the path includes numerous subfolders
so the formula needs to take that into consideration.

I have seen workable formulas in this site but cannot, for the life of me,
find them now. Any and all help is greatly appreciated.
--
Best wishes,

Jim


--

Dave Peterson

Don Guillett

Separating Location and Filename in a cell
 
Sub getfilename()
For Each c In Selection
x = InStrRev(c, "\")
c.Offset(, 1) = Left(c, x)
c.Offset(, 2) = Right(c, Len(c) - x)
Next
End Sub

--
Don Guillett
SalesAid Software

"Jim Jackson" wrote in message
...
I have a long list of Files which include the complete path. I need tro
separate the filename ("JohnDoe.xls") from the first part of the cell
("C:\Files\Clients\"). In some cells the path includes numerous
subfolders
so the formula needs to take that into consideration.

I have seen workable formulas in this site but cannot, for the life of me,
find them now. Any and all help is greatly appreciated.
--
Best wishes,

Jim




Jim Jackson

Separating Location and Filename in a cell
 
Don and Dave,

Thanks very much. You gave me both a formula I could make just a little
change to and a bit of code I could interject into a macro I am building. It
always helps to have a choice in such matters.
--
Best wishes,

Jim


"Don Guillett" wrote:

Sub getfilename()
For Each c In Selection
x = InStrRev(c, "\")
c.Offset(, 1) = Left(c, x)
c.Offset(, 2) = Right(c, Len(c) - x)
Next
End Sub

--
Don Guillett
SalesAid Software

"Jim Jackson" wrote in message
...
I have a long list of Files which include the complete path. I need tro
separate the filename ("JohnDoe.xls") from the first part of the cell
("C:\Files\Clients\"). In some cells the path includes numerous
subfolders
so the formula needs to take that into consideration.

I have seen workable formulas in this site but cannot, for the life of me,
find them now. Any and all help is greatly appreciated.
--
Best wishes,

Jim





Don Guillett

Separating Location and Filename in a cell
 
Glad to help

--
Don Guillett
SalesAid Software

"Jim Jackson" wrote in message
...
Don and Dave,

Thanks very much. You gave me both a formula I could make just a little
change to and a bit of code I could interject into a macro I am building.
It
always helps to have a choice in such matters.
--
Best wishes,

Jim


"Don Guillett" wrote:

Sub getfilename()
For Each c In Selection
x = InStrRev(c, "\")
c.Offset(, 1) = Left(c, x)
c.Offset(, 2) = Right(c, Len(c) - x)
Next
End Sub

--
Don Guillett
SalesAid Software

"Jim Jackson" wrote in message
...
I have a long list of Files which include the complete path. I need tro
separate the filename ("JohnDoe.xls") from the first part of the cell
("C:\Files\Clients\"). In some cells the path includes numerous
subfolders
so the formula needs to take that into consideration.

I have seen workable formulas in this site but cannot, for the life of
me,
find them now. Any and all help is greatly appreciated.
--
Best wishes,

Jim








All times are GMT +1. The time now is 01:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com