Return the Workbook Name to a Cell in Microsoft Excel
Excel
Tip: In the formulas below, "filename" is exactly what you type, it's not something that means you're supposed to type your file name.
- Return the file name without the path:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]", CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)
- Return the file name with the path:
=SUBSTITUTE(SUBSTITUTE(LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))),"[",""),"]","")