SOLVED

Insert current file name only

%3CLINGO-SUB%20id%3D%22lingo-sub-3209132%22%20slang%3D%22en-US%22%3EInsert%20current%20file%20name%20only%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3209132%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20using%20the%20formula%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CP%3E%3CSTRONG%3E%3DMID(CELL(%22filename%22)%2CSEARCH(%22%5B%22%2CCELL(%22filename%22))%2B1%2C%20SEARCH(%22%5D%22%2CCELL(%22filename%22))-SEARCH(%22%5B%22%2CCELL(%22filename%22))-1)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Eto%20insert%20the%20file%20name%20into%20a%20cell.%3C%2FP%3E%3CP%3EI%20would%20like%20this%20to%20work%20without%20inserting%20the%20.%3CSTRONG%3Exlsx%26nbsp%3B%3C%2FSTRONG%3Esuffix.%20How%20can%20this%20formula%26nbsp%3B%20be%20modified%20to%20achieve%20that%20please%3F%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3209132%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3209165%22%20slang%3D%22en-US%22%3ERe%3A%20Insert%20current%20file%20name%20only%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3209165%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1316695%22%20target%3D%22_blank%22%3E%40eddymalcs%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DSUBSTITUTE(MID(CELL(%22filename%22)%2CSEARCH(%22%5B%22%2CCELL(%22filename%22))%2B1%2C%20SEARCH(%22%5D%22%2CCELL(%22filename%22))-SEARCH(%22%5B%22%2CCELL(%22filename%22))-1)%2C%22.xlsx%22%2C%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
New Contributor

I am using the formula 

=MID(CELL("filename"),SEARCH("[",CELL("filename"))+1, SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1)

to insert the file name into a cell.

I would like this to work without inserting the .xlsx suffix. How can this formula  be modified to achieve that please?

2 Replies
best response confirmed by eddymalcs (New Contributor)
Solution

@eddymalcs Perhaps like this?

 

=SUBSTITUTE(MID(CELL("filename"),SEARCH("[",CELL("filename"))+1, SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1),".xlsx","")

 

Thank you, that works well.