View Single Post
  #3   Report Post  
ivano
 
Posts: n/a
Default


"Steve Mackay" ha scritto nel messaggio
...
Hi,

I need a formula that will return a file name with only the folder it is

in,
not the entire file path.

For instance, if the full path of the file is:
C:\Documents and Settings\Steve\Desktop\Africa\[MyFile.xls]

I would want the formula to return:
Africa\[MyFile.xls]

I've have a formula that will return just the file name:

=MID(CELL("filename"),FIND("[",CELL("filename"))+1,FIND("]",CELL("filename")
)-FIND("[",CELL("filename"))-1)

And on that returns just the path:
=MID(CELL("filename"),1,FIND("[",CELL("filename"))-1)

But I can't figure out how to combine these two to get a partial path.

Thanks
Steve Mackay


Hy Steve,
try to a array formula (CTRL+SHIFT+ENTER):
=MID(CELL("filename"),LARGE(IF(MID(CELL("filename" ),seq,1)="\",seq,""),2)+1,
SEARCH("]",CELL("filename"))-LARGE(IF(MID(CELL("filename"),seq,1)="\",seq,""
),2))

After you have defined "seq" as:
=ROW(INDIRECT("1:1024"))

ivano