How to extract a single filename from amongst many subfolders and files.

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
How to extract the last filename from amongst many subfolders and files. for example the following filename
D:\Users\Server One\Dropbox\Steve Share\2021\02-2021 (steve.jobs).xlsb
be output into cell A1.
You can see from the above example that there are 5 folders in this example. The last folder name are the years.
How do I first pick the highest value example 2021 and not 2018, 2019 or 2020.
and inside each of these folders there are 12 files that begins with numbers 01-12 , each representing the month number except for the year 2021 as the month of march has not been started as of now.
So for 2021 only 01-2021 (steve.jobs).xlsb and 02-2021 (steve.jobs).xlsb exists. Out of the two the highest first two digits are required, example 02-2021 (steve.jobs).xlsb, a complete filename in cell A1. just like in above example.

Will appreciate any help.

P.S. This will be required for indirect referencing of a formula.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
You can refer here to automatically search for Folder and find latest File

Search for Folder

Find latest File in a Folder
 
Upvote 0
You can refer here to automatically search for Folder and find latest File

Search for Folder

Find latest File in a Folder
Thank you for your answer. I believe it can be also made possible using the power query. All I want in the end is to combine two files with similar content and template into one workbook while keeping all the sheets intact . I think with power query the sheets are combined into one.
 
Upvote 0

Forum statistics

Threads
1,212,933
Messages
6,110,756
Members
448,295
Latest member
Uzair Tahir Khan

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