How do I display the file name in the worksheet?

  • Thread starter Thread starter Guest
  • Start date Start date
You will need to do some parsing to get the filename out, but this will give
you the whole reference of the path, filename and sheet

=CELL("Filename")

This give you just the filename

=MID(CELL("Filename"),FIND("[",CELL("Filename"),1)+1,(FIND(".",CELL("Filename"),1)+4)-(FIND("[",CELL("Filename"),1)+1))

(Beware the wrap above)

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
(e-mail address removed)
 
No matter which of the suggested formulas you use, you'll be better off to
include a cell reference in those formulas:

=cell("filename",a1)

If you fail to include a cell reference, then when excel recalculates, the
formula will evaluate using whatever worksheet/workbook is active.

(You can see this by using two workbooks, arranging the windows (window|arrange)
and putting:

=cell("filename")

in each window.

Then look at the opposite window.
 

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