Filename giving me strange results

brianfosterblack

Active Member
Joined
Nov 1, 2011
Messages
251
I am using the following formula to show the filename in my workbook named "Mailer", which I then use in my code
Excel Formula:
=MID(CELL("filename"),SEARCH("[",CELL("filename"))+1,SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1)
I have another workbook with the Name "Members" with the same formula in it.
If I have the Mailer workbook open and then also open the Member Workbook at the same time, my formula in The Mailer workbook changes it result to give the workbook name as Members
The formula in both workbooks gives the result as a Members

Anyone know what is happening and how to prevent this. The result I need is for the formula in each workbook to provide the workbook name without the .xlsm on the end of the name

I can currently achieving that but only if one workbook is open at a time.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
You need to assign a firm reference to all those CELL...
Excel Formula:
=MID(CELL("filename",A1),SEARCH("[",CELL("filename",A1)etc etc
Otherwise its result is based on which is the current selection

If your version is Office 365 then your formula can be simplified using the function LET

Bye
 
Upvote 0
Solution
You need to assign a firm reference to all those CELL...
Excel Formula:
=MID(CELL("filename",A1),SEARCH("[",CELL("filename",A1)etc etc
Otherwise its result is based on which is the current selection

If your version is Office 365 then your formula can be simplified using the function LET

Bye
Thank you. This resolves the problem. I am using 365 but not all others using the workbook are.
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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