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
- Smartsheet Customer Resources
- 64.1K Get Help
- 414 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!