Get the file name from a file path.
I have a column that contains file paths.
"/Shared/Users/Bob/bob.txt"
Assume there can be any amount of folders, with names of any length.
I just want an adjacent column to say "bob.txt"
I have tried to find the index of the last "/" and work with that, but to no avail.
How can this be done?
Best Answer
-
Give this a try…
=MID([Column Name]@row, FIND("~", SUBSTITUTE([Column Name]@row, "/", "~", LEN([Column Name]@row) - LEN(SUBSTITUTE([Column Name]@row, "/", "")))) + 1, LEN([Column Name]@row) - (FIND("~", SUBSTITUTE([Column Name]@row, "/", "~", LEN([Column Name]@row) - LEN(SUBSTITUTE([Column Name]@row, "/", ""))))))
Answers
-
Give this a try…
=MID([Column Name]@row, FIND("~", SUBSTITUTE([Column Name]@row, "/", "~", LEN([Column Name]@row) - LEN(SUBSTITUTE([Column Name]@row, "/", "")))) + 1, LEN([Column Name]@row) - (FIND("~", SUBSTITUTE([Column Name]@row, "/", "~", LEN([Column Name]@row) - LEN(SUBSTITUTE([Column Name]@row, "/", ""))))))
-
Fantastic, thank you!
-
Happy to help. 👍️
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.5K Get Help
- 424 Global Discussions
- 136 Industry Talk
- 465 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 146 Just for fun
- 63 Community Job Board
- 465 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 301 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!