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

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,018
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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Zot

Well-known Member
Joined
Nov 26, 2020
Messages
1,171
Office Version
  1. 2016
Platform
  1. Windows
You can refer here to automatically search for Folder and find latest File

Search for Folder

Find latest File in a Folder
 

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,018
Office Version
  1. 2019
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,931
Messages
5,639,064
Members
417,067
Latest member
rohitbabshet

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