Get the file path without the file name

jwalkerack

Board Regular
Joined
Jun 19, 2013
Messages
81
Hello ,

i have a long list of file directories on a spreadsheet.

Intially i wanted to seperate the file name. i was able to find a post online which allowed me to do this

get filename from filepath and filename

But now i would like to just have the file path without the file name

So if my full directory was

S:\AppsData\Excel\Jack\TEST\Football_players.xls

i would like the end result to be

S:\AppsData\Excel\Jack\TEST\


Is there an easy way of doing this ...


Thanks a lot Jack
 
Thanks Guys , that was great , help , i had already for the file name from the at link i had on the first message of the post.

i was then used the subsitute formala as you guys , stated ,

Thanks a lot
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
(1) file path: =LEFT(CELL("filename"),SEARCH("[",CELL("filename"),1)-2)

(2) file name: =MID(CELL("filename"),SEARCH("[",CELL("filename"),1)+1,SEARCH("]",CELL("filename"),1)-SEARCH("[",CELL("filename"),1)-1)

(3) tab name: =MID(CELL("filename"),SEARCH("]",CELL("filename"),1)+1,99)

-----------------------

(4) file path+name: =LEFT(CELL("filename"),SEARCH("[",CELL("filename"),1)-2)&""&MID(CELL("filename"),SEARCH("[",CELL("filename"),1)+1,SEARCH("]",CELL("filename"),1)-SEARCH("[",CELL("filename"),1)-1)
 
Upvote 0
@cgiesbre
Welcome to the MrExcel board!

I am not sure whose question you are answering(?) but since you have MS365 those values can be obtained with simpler formulas as shown below. Also note also that your 'path + name' formula omits the final separator.

Cell Formulas
RangeFormula
B1B1=LEFT(CELL("filename"),SEARCH("[",CELL("filename"),1)-2)
C1C1=TEXTBEFORE(CELL("filename"),"\[")
B2B2=MID(CELL("filename"),SEARCH("[",CELL("filename"),1)+1,SEARCH("]",CELL("filename"),1)-SEARCH("[",CELL("filename"),1)-1)
C2C2=INDEX(TEXTSPLIT(CELL("filename"),{"[","]"}),2)
B3B3=MID(CELL("filename"),SEARCH("]",CELL("filename"),1)+1,99)
C3C3=TEXTAFTER(CELL("filename"),"]")
B4B4=LEFT(CELL("filename"),SEARCH("[",CELL("filename"),1)-2)&""&MID(CELL("filename"),SEARCH("[",CELL("filename"),1)+1,SEARCH("]",CELL("filename"),1)-SEARCH("[",CELL("filename"),1)-1)
C4C4=SUBSTITUTE(TEXTBEFORE(CELL("filename"),"]"),"[","")
 
Upvote 0

Forum statistics

Threads
1,224,154
Messages
6,176,731
Members
452,740
Latest member
MrCY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top