File name does not recalculate

ozbeachbum

Board Regular
Joined
Jun 3, 2015
Messages
221
Office Version
  1. 2021
Platform
  1. Windows
=(LET(f,CELL("filename",A29),REPLACE(REPLACE(f,FIND("]",f),500,""),1,FIND("[",f),"")))
I am using the above formula to show the file name of a template, it works fine until I want to change the name.
When I save as to the same folder it retains the original file name, F9 does not correct it, however when I close and reopen it changes to the correct name.
As it is a template I need to save or move it to a different folder, in both cases when the file is opened all it only shows e-, neither character being part of the file name.
Example of file name being saved: ZZZ 410701 (ph) stf^out^
Any assistance or comments greatly appreciated.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I do not know if these functions are in Excel 2021.
I will check for an earlier version.

Try =TEXTBEFORE(TEXTAFTER(CELL("filename",$A$1),"["),".")
 
Upvote 0
It looks like it has something to do with the file path being long.
I tried saving and moving it to a shorter file path and it retained the correct name.
Possibly the only solutions are either shorter file path or delete the idea.
 
Upvote 0
Test2024.xlsx
A
10Test2024
11Test2024.xlsx
Sheet1
Cell Formulas
RangeFormula
A10A10=LET(a,CELL("filename",A2),MID(a,SEARCH("[",a)+1,SEARCH(".",a)-1-SEARCH("[",a)))
A11A11=LET(a,CELL("filename",A2),MID(a,FIND("[",a)+1,FIND("]",a)-FIND("[",a)-1))
 
Upvote 0
Both work when saved to same folder and moved to short file path folder, however when I move it to the long file path folder it does not work.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top