ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   File name insertion in cell (https://www.excelbanter.com/excel-worksheet-functions/246324-file-name-insertion-cell.html)

balterson

File name insertion in cell
 
I have the =cell("filename",a1) formula, but what if you only what just the
file name and not the whole path??? This is driving me crazy, that I can't
figure it out.

Thank you
Bonnie


Gord Dibben

File name insertion in cell
 
File path, file and worksheet name:
=CELL("filename",A1)

File path only:
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1)

File name only:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CELL("filename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

The sheet name:
=MID(CELL("Filename",A1),FIND("]",CELL("Filename",A1))+1,255)

More on this can found at Bob Phillips' site.

http://www.xldynamic.com/source/xld.xlFAQ0002.html


Gord Dibben MS Excel MVP

On Thu, 22 Oct 2009 11:55:01 -0700, balterson
wrote:

I have the =cell("filename",a1) formula, but what if you only what just the
file name and not the whole path??? This is driving me crazy, that I can't
figure it out.

Thank you
Bonnie



Gary''s Student

File name insertion in cell
 
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CELL("filename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

--
Gary''s Student - gsnu200908


"balterson" wrote:

I have the =cell("filename",a1) formula, but what if you only what just the
file name and not the whole path??? This is driving me crazy, that I can't
figure it out.

Thank you
Bonnie


Dave Peterson

File name insertion in cell
 
And check your other post, too.

balterson wrote:

I have the =cell("filename",a1) formula, but what if you only what just the
file name and not the whole path??? This is driving me crazy, that I can't
figure it out.

Thank you
Bonnie


--

Dave Peterson


All times are GMT +1. The time now is 07:04 PM.

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