Extract Month from file name

ruckuz

New Member
Joined
Dec 28, 2010
Messages
36
Hi,
I need to extract the month of the year from the file name.

\\srv-ef-w-001\shared\Financial Statements\Financial Statements\Month End 2016\12 December 2016\[Lease Disclosure - December.xlsx]Voucher Summary

The file path above I used the cell filename function to get the full address of the file. However, I just need December and I tried the mid formula but since July has less letters than december, I would get blank spaces for july. my question is how do i get july and december w/o the extra spaces after (y) or (r)? I just want July or December w/o any empty spaces afterwards. Thanks!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Assuming that the file name always begins with: "[Lease Disclosure - "
try:
Code:
=TRIM(MID(A1,FIND("[Lease Disclosure - ",A1)+20,FIND(".xlsx",A1)-FIND("[Lease Disclosure - ",A1)-20))
 
Upvote 0
Or try this

=TEXT(TRIM(RIGHT(SUBSTITUTE(REPLACE(A1,FIND("\[",A1),LEN(A1),""),"",REPT(" ",255)),255)),"mmmm")
 
Upvote 0
Thank you! works perfectly!

What does the [ before lease disclosure do? i'm not quite following the formula after FIND.
 
Upvote 0
I am using the MID formula (see: https://www.techonthenet.com/excel/formulas/mid.php).
So, we need to find the starting position, which is just AFTER the string "[Lease Disclosure - ". So we need to go 20 spaces after the beginning of that to find where the beginning of our month is.
In the last argument, we need to find the length. So, we find where ".xlsx" starts, and subtract out where the first part starts.
 
Upvote 0
Ah, i get it now. i understand the MID formula, I just didn't get the "[lease..." thank you so much! I will save this post for future references.
 
Upvote 0
I was just looking for something identifiable to locate just before the month name to hone in on.
 
Upvote 0

Forum statistics

Threads
1,224,155
Messages
6,176,736
Members
452,741
Latest member
Muhammad Nasir Mahmood

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