How to Extract the Last filename from a Folder/Subfolder?

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
Hi, how are you?



The directory is

D:\Users\"*"\Dropbox\Sara Share\

The next folder that comes is the year
example
D:\Users\"*"\Dropbox\Sara Share\2019
D:\Users\"*"\Dropbox\Sara Share\2020
D:\Users\"*"\Dropbox\Sara Share\2021

Each of these folders will contain file/s in the format as

01-2021 (sara.ali).xlsb
02-2021 (sara.ali).xlsb
11-2021 (sara.ali).xlsb
12-2021 (sara.ali).xlsb
01-2020 (sara.ali).xlsb
02-2020 (sara.ali).xlsb


I want a formula that could check if filename ends with .xlsb then extract the complete filename with directory of the highest value only.

In this case the formula would output the following string

D:\Users\Sara Ali\Dropbox\Sara Share\2021\12-2021 (sara.ali).xlsb

I hope it would be easy for the Gurus.

Thank you.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,215,132
Messages
6,123,227
Members
449,091
Latest member
jeremy_bp001

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