Display file name without the file type extension

  • Thread starter Thread starter NAHolmes
  • Start date Start date
Try the below in a saved workbook.

=TRIM(LEFT(SUBSTITUTE(MID(CELL("filename",A1),
FIND("[",CELL("filename",A1))+1,255),".xl",REPT(" ",255)),255))

If this post helps click Yes
 
Try this
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-6)

Keep in mind that the "filename" used with CELL() does not return anything
until the workbook has been saved.

or if you definitely know that the filename ends with .xlsx (and not .xlsm
or other Excel 2007 file type identifier), then this would work
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND(".xlsx]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)
 
This also worked, again - many thanks.

JLatham said:
Try this:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-6)

Keep in mind that the "filename" used with CELL() does not return anything
until the workbook has been saved.

or if you definitely know that the filename ends with .xlsx (and not .xlsm
or other Excel 2007 file type identifier), then this would work:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND(".xlsx]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)


NAHolmes said:
Is it possible to return the file name value to a cell without the '.xlsx'?

Thanks.
 
This worked perfectly - many thanks.

Jacob Skaria said:
Try the below in a saved workbook.

=TRIM(LEFT(SUBSTITUTE(MID(CELL("filename",A1),
FIND("[",CELL("filename",A1))+1,255),".xl",REPT(" ",255)),255))

If this post helps click Yes
---------------
Jacob Skaria


NAHolmes said:
Is it possible to return the file name value to a cell without the '.xlsx'?

Thanks.
 
This is a great resource:
http://www.mcgimpsey.com/excel/formulae/cell_function.html

HTH,
Ryan--

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


NAHolmes said:
This also worked, again - many thanks.

JLatham said:
Try this:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-6)

Keep in mind that the "filename" used with CELL() does not return anything
until the workbook has been saved.

or if you definitely know that the filename ends with .xlsx (and not .xlsm
or other Excel 2007 file type identifier), then this would work:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND(".xlsx]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)


NAHolmes said:
Is it possible to return the file name value to a cell without the '.xlsx'?

Thanks.
 
Back
Top