Extracting a filename from a full path (Windows)
This would be an easy task if we were looking for the first backslash in the full pathname.
We need to first determine the number of backslashes by figuring out the lenght of the original path with the backslashes removed …
LEN(A1)-LEN(SUBSTITUTE(A1;”\”;”")
We now swap out the last backslah with a space character - CHAR(13) ..
SUBSTITUTE(A1;”\”;CHAR(13);LEN(A1)-LEN(SUBSTITUTE(A1;”\”;”")
Finally, we use the MID function complete the extraction of the filename.
=MID(A1;FIND(CHAR(13);SUBSTITUTE(A1;”\”;CHAR(13);LEN(A1)-LEN(SUBSTITUTE(A1;”\”;”")
