Filename in Excel Cell Address

R

RickS

Is there a way to insert an excel spreadsheet filename into a cell within the
same spreadsheet, like the &[File] command in the Header/Footer screen?
 
M

Mike H

Hi,

For the Fullname including path

=CELL("filename")

for the file name only

=MID(CELL("filename"),SEARCH("[",CELL("filename"))+1,
SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1)

Note the workbook must be save for this to work
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
R

RickS

Thanks for your help Mike,

I used the ful path name and it works fine, except it also added the
"Sheet1" at them end, any way not to have that?
--
Thanks,
RickS


Mike H said:
Hi,

For the Fullname including path

=CELL("filename")

for the file name only

=MID(CELL("filename"),SEARCH("[",CELL("filename"))+1,
SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1)

Note the workbook must be save for this to work
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


RickS said:
Is there a way to insert an excel spreadsheet filename into a cell within the
same spreadsheet, like the &[File] command in the Header/Footer screen?
 
R

RickS

thanks Mike,

I used the full file path approach and it is what I wanted, but it also
placed the "Sheet1" at the end, is there a way to suppress this?
 
R

RickS

thanks Gary,

is there a way to not get the "Sheet1" at the end of the path and filename?
--
Thanks,
RickS


Gary Keramidas said:
yes

=CELL("filename")

--


Gary Keramidas
Excel 2003


RickS said:
Is there a way to insert an excel spreadsheet filename into a cell within
the
same spreadsheet, like the &[File] command in the Header/Footer screen?

.
 
G

Gary Keramidas

maybe this

=LEFT(CELL("filename"),FIND("[",CELL("filename"),1)-1)
--


Gary Keramidas
Excel 2003


RickS said:
thanks Gary,

is there a way to not get the "Sheet1" at the end of the path and
filename?
--
Thanks,
RickS


Gary Keramidas said:
yes

=CELL("filename")

--


Gary Keramidas
Excel 2003


RickS said:
Is there a way to insert an excel spreadsheet filename into a cell
within
the
same spreadsheet, like the &[File] command in the Header/Footer screen?

.
 

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