Offset Filename

ruckuz

New Member
Joined
Dec 28, 2010
Messages
36
Hi,
I'm trying to get just the filename and i used this formula, =MID(CELL("filename",E30),90,13). the formula works fine until there's more characters then it doesn't capture what is need and i would need to change the "13" to a 14 or 15 depending on how many more characters. I know the offset formula will work but it's a tricky formula & i still haven't gotten it down.

S:\FinancialStatements\FinancialStatements\Route66\2019\02February2019[GLDetail-February2019.xlsx]Recon

<tbody>
</tbody>

Above is the file name. i'm just trying to capture the month and year of the file and like i said the mid formula works until it's the next month then i'll need to change the mid formula. what's the formula for offset so i don't need to change the formula every month? Thanks.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Trevor_S

Well-known Member
Joined
Oct 17, 2015
Messages
634
Office Version
  1. 2016
Platform
  1. Windows
Can you do it by finding the square brackets, e.g.:
=MID(CELL("filename",E30),FIND("[",CELL("filename",E30))+10,FIND("]",CELL("filename",E30))-FIND("[",CELL("filename",E30))-14)
You may need to adjust the +10 and -14 figures to start with (as I haven't been able to test it), but once you have the right numbers, there's no need to change them each month.
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
14,796
Office Version
  1. 2010
Platform
  1. Windows
Try this

=TRIM(MID(SUBSTITUTE(CELL("filename",E30),"]",REP(" ",500)),SEARCH("[",CELL("filename",E30))+1,100))
 

ruckuz

New Member
Joined
Dec 28, 2010
Messages
36
Thank you. It worked. I think I know what you did, a lot of counting spaces.
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
14,796
Office Version
  1. 2010
Platform
  1. Windows
It is right.
with pleasure. thanks for the feedback
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,301
Messages
5,836,493
Members
430,436
Latest member
fefenouil

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
Top