Excel filename in template without ".xls" extension?

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

Hi all,

I have read the article that excel can auto insert the file name in a
cell using this:
=LEFT(MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,255),FIN
D(".",
MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,255))+3)

which, for example, will return "abc.xls" in the cell if the file name
is abc.xls

If i want the cell to show "abc" only (without the extension xls) is
there a way to do so?

Thanks.

--
 
One way:

=MID(LEFT(CELL("filename",A1), FIND(".",CELL("filename",A1))-1),
FIND("[",CELL("filename",A1))+1, 255)

This assumes there's only one "." in the filename and path.
 
Back
Top