read the name of a saved file - put that value into a cell

  • Thread starter Thread starter Max Bialystock
  • Start date Start date
M

Max Bialystock

Is it possible to read the name of a saved file and put that value into a
cell in that same workbook?
 
Max,

You can do this with a formula:

=SUBSTITUTE(MID(CELL("filename",A1),1,FIND("]",CELL("filename",A1
))-1),"[","")

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Hi David
if you mean the current workbook have a look at the following formulas:
File path and file 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("]",CEL
L("filename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

The sheet name
=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("file
name",A1),1))
 
Many thanks for your help.

Max


Chip Pearson said:
Max,

You can do this with a formula:

=SUBSTITUTE(MID(CELL("filename",A1),1,FIND("]",CELL("filename",A1
))-1),"[","")

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




Max Bialystock said:
Is it possible to read the name of a saved file and put that value into a
cell in that same workbook?
 
Frank,
Many thanks for your help,

Max

Frank Kabel said:
Hi David
if you mean the current workbook have a look at the following formulas:
File path and file 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("]",CEL
L("filename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

The sheet name
=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("file
name",A1),1))

--
Regards
Frank Kabel
Frankfurt, Germany

Max Bialystock said:
Is it possible to read the name of a saved file and put that value into a
cell in that same workbook?
 

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

Back
Top