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
Check out the Formula Handbook template!