Display file name without the file type extension

N

NAHolmes

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

Thanks.
 
J

Jacob Skaria

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
 
J

JLatham

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)
 
N

NAHolmes

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.
 
N

NAHolmes

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.
 
R

ryguy7272

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.
 

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