get path for subfolder

twistsd

New Member
Joined
Sep 8, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I have an excel file stored on OneDrive in a folder, which has a subfolder called FolderA which has subfolders called site1, site2 etc. I can get the file path for the main file to display in a cell and then concatenate and add the subfolders into another cell. The issue I have is sometimes my pc opens the file and the path is C:\\folder..... and other times its https://onderivefolder, the problem is the "/" & "\" in the concatenate and how to get the correct one depending upon which path type is displayed. Any help on how to best address this would be gratefully appreciated.
Thanks
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Explain what's happening . Is the file saved on your pc desktop and what error is appearing.
 
Upvote 0
Explain what's happening . Is the file saved on your pc desktop and what error is appearing.

The file is stored on OnDrive.

I have a cell with
Excel Formula:
=LEFT(@CELL("filename"),FIND("[",@CELL("filename"),1)-1)
which gives the following C:\Users\S\OneDrive - S.org.uk\Plan\ if I open the file from file explorer but if I open the file form within Excel I get https://s-my.sharepoint.com/personal/s_xx_org_uk/Documents/Circuit/ .

Within that folder I have a subfolder which then has 4 other folders for output from the Excel file to be stored. If I use
Excel Formula:
=CONCATENATE(B5,"Images")
for the subfolder that works it adds the subfolder name but how do I get it to add the correct path separator after the subfolder name?

Thanks
 
Upvote 0
still not clear . Please give one example with answer manually as to what patch you want to appear in excel.
 
Upvote 0
still not clear . Please give one example with answer manually as to what patch you want to appear in excel.
If I open the file from my laptop from file explorer the path is shown as C:\Users\S\OneDrive - S.org.uk\Plan\ if I open it from within Excel or on a mac the path is shown as https://s-my.sharepoint.com/personal/s_xx_org_uk/Documents/Circuit/ so trying to use the concatenate formula to add the two subfolders is proving difficult as it will only work for either the local path or OneDrive path.

If I add "SubFolder\Folder\" in the concatenate formula I get C:\Users\S\OneDrive - S.org.uk\Plan\SubFolder\Folder\ which is fine but with the OneDrive path it shows as https://s-my.sharepoint.com/personal/s_xx_org_uk/Documents/Circuit/SubFolder\Folder\ and if it try to add "SubFolder/Folder/" in the concatenate formula I get C:\Users\S\OneDrive - S.org.uk\Plan\SubFolder/Folder/ or https://s-my.sharepoint.com/personal/s_xx_org_uk/Documents/Circuit/SubFolder/Folder/ .

So what I want to be able to do is add subfolder & folder to the path in the correct format for both local & OneDrive.

Thanks
 
Upvote 0
I am not diving deep . just try substitute formula to substitute "/" with "\" and vice versa using if error formula as an advantage.
 
Upvote 0
I am not diving deep . just try substitute formula to substitute "/" with "\" and vice versa using if error formula as an advantage.
Thanks.

How would I generate that to run when the file opens?
 
Upvote 0
Thanks.

How would I generate that to run when the file opens?
If the link changes upon opening file i don't think you can do that because the link is appearing on another platform / browser.
Have you tried browser (From Web) within excel . I am just exploring . This is not a solution
 
Upvote 0

Forum statistics

Threads
1,215,743
Messages
6,126,613
Members
449,322
Latest member
Ricardo Souza

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