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
- 63.4K Get Help
- 394 Global Discussions
- 213 Industry Talk
- 449 Announcements
- 4.6K Ideas & Feature Requests
- 141 Brandfolder
- 132 Just for fun
- 131 Community Job Board
- 453 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 293 Events
- 35 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!