REMOVE FILE EXTENSION FROM NAME IN CELL FORMAT

Anonymous
2025-05-16T06:29:08+00:00

Im using =MID(CELL("filename"),SEARCH("[",CELL("filename"))+1, SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1) to get only the file name in my excel cell but when i try and get rid of the .xlsx at the end i get its not valid? anyone know what I need to add to the end

Microsoft 365 and Office | Excel | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Andreas Killer 144K Reputation points Volunteer Moderator
    2025-05-16T07:09:14+00:00

    How about this:

    =LET(
    n,CELL("filename"),
    f,SEARCH("[",n),
    t,SEARCH("]",n),
    p,MID(n,f+1,t-f-1),
    SUBSTITUTE(p,".xlsx",""))

    Old formula style:

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

    Andreas.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Ashish Mathur 100.8K Reputation points Volunteer Moderator
    2025-05-16T23:17:41+00:00

    Hi,

    Enter this formula

    =REGEXEXTRACT(CELL("filename"),"(?<=[)[^.]]+")

    Hope this helps.

    0 comments No comments