Excel Fox
05-28-2011, 03:17 PM
This will give the path of the parent folder. The advantage of this formula is that you can pass the hierarchy level by just changing the last argument in the formula (highlighted in bold red)
Array Formula (confirmed by pressing CTRL+SHIFT+ENTER, this formula is otherwise known as CSE formula)
=LEFT(A1,LARGE((MID(A1,ROW(1:255),1)="\")*IFERROR(SEARCH("\",A1,ROW(1:255)),0),1))
Example
I:\Pictures\Wallpapers\World Over\Misc Pics\New Delhi.jpg
the above formula will give
I:\Pictures\Wallpapers\World Over\Misc Pics\
Changing the argument to 2
I:\Pictures\Wallpapers\World Over\
3
I:\Pictures\Wallpapers\
so on and so forth.....:)
Array Formula (confirmed by pressing CTRL+SHIFT+ENTER, this formula is otherwise known as CSE formula)
=LEFT(A1,LARGE((MID(A1,ROW(1:255),1)="\")*IFERROR(SEARCH("\",A1,ROW(1:255)),0),1))
Example
I:\Pictures\Wallpapers\World Over\Misc Pics\New Delhi.jpg
the above formula will give
I:\Pictures\Wallpapers\World Over\Misc Pics\
Changing the argument to 2
I:\Pictures\Wallpapers\World Over\
3
I:\Pictures\Wallpapers\
so on and so forth.....:)