• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to get name of the last folder from folder path

This will be 2 folded formula:

1) First we need to find the position of the last "\" character.. we can achieve the same by using:

Code:
=FIND("@",SUBSTITUTE(A1,"\","@",(LEN(A1)-LEN(SUBSTITUTE(A1,"\","")))/LEN("\")))

2) Then we can use this value and using the Right function we can extract the last part of the given value:

In total, the formula you can use to capture the last value is:

Code:
=RIGHT(A1,LEN(A1)-FIND("@",SUBSTITUTE(A1,"\","@",(LEN(A1)-LEN(SUBSTITUTE(A1,"\","")))/LEN("\"))))

Hope this helps!!
 
Hi Sachin !

Closed to previous formula :​
Code:
=RIGHT(A1,LEN(A1)-FIND("|",SUBSTITUTE(A1,"\","|",LEN(A1)-LEN(SUBSTITUTE(A1,"\","")))))
You like ?
 
Back
Top