When a formula in Excel refers to a cell in another file, Excel stores a relative pathname so that if you move the files the links don't break. This works as I expect when the files are stored on a network drive, but not when the files are stored in a SharePoint doc library. Any ideas why and how I can fix it?
In more detail ...
Setup 1 (works perfectly)
\\server\UserFiles$\MClarke\My Documents\Folder1\a.xlsx includes the formula ='\\server\UserFiles$\MClarke\My Documents\Folder1\[b.xlsx]Sheet1'!$A$1
Move both files from Folder1 to Folder2
Open \\server\UserFiles$\MClarke\My Documents\Folder2\a.xlsx and the formula automatically changes to ='\\server\UserFiles$\MClarke\My Documents\Folder2\[b.xlsx]Sheet1'!$A$1
Setup 2 (fails)
http://intranet-server/dept/Folder1/a.xlsx includes the formula ='http://intranet-server/dept/Folder1/[b.xlsx]Sheet1'!$A$1
Move both files from Folder1 to Folder2
Open http://intranet-server/dept/Folder2/a.xlsx and the formula (incorrectly) still says ='http://intranet-server/dept/Folder1/[b.xlsx]Sheet1'!$A$1
I have tried moving and opening files in Setup 2 with both a mapped network drive and using SharePoint's "Open with Explorer" function. Both approaches give the same undesired behaviour: the formula in the moved file continues to point to the original location of the file rather than the new location. So why would Excel store an absolute path in that case but a relative path in Setup 1?
I tried many alternatives and eventually found that the only way to update the file references was to do so manually using the Edit Links dialog from the Data ribbon. That works perfectly, but is just a bit annoying.
Related
I have two workbooks in the same folder. I reference a cell from one workbook to another eg
='[WorkbookB.xlsx]Sheet1'!$A$1
When I save and close the two files, once I reopen them the formula has changed to a hardcoded path eg
='C:\Users\Me\Documents\[WorkbookB.xlsx]Sheet1'!$A$1
Then if I move the two files to another folder, the link breaks. Is there a way to keep the file paths relative, so as long as the two workbooks are in the same folder then it will still work? I've searched around and can't even work out if this is the expected behaviour as I've found people with the exact opposite problem, but this is how it's played out for me and I haven't found a solution. Any help would be appreciated.
Nevermind figured it out. The default behaviour is for the links to be relative, as I wanted. They weren't working because I moved both the files on to the desktop to test them out. Turns out they need to be in a folder otherwise excel can't find them.
I want to read the text from excel and find the corresponding folder in windows.
Let say, I have excel file containing the list of folder I want to open in file explorer.
and here is my folder.
So I want to read from excel file on cell A2, then after read “dotnet”, I want to find in the screen, where is “dotnet” folder. I have tried using function “text exist”. However, it wasnt working.
Can anybody tell me which function should I use to find the corresponding folder?
Use read range activity to read all data from excel. Once you have the directory, use for each item in data table, you can simply open run command with send hot key (win + r) and type into your directory.
That should open the folder up for you.
In the picture above I have placed the following formula in cell J1:
=HYPERLINK(LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1),LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1))
I originally created the file on my local C: drive and personal download folder. I then created hyper link formulas in I4, and copied down, that build on the path name J1. This worked fine and dandy when I tested it.
PROBLEM
When I move the file to the network drive, the value in cell J1 showed the new new network path. However when I click on the link it would open my personal download folder where I originally created and saved the workbook.
What I have tried
I thought there might be some value saved some where that was not updated when I moved the file since I used explorer to move the file as opposed to saving the open workbook in a new location. To over come that I tried saving the file in its new location with no effect. I also tried save as with no effect either.
What I was trying to achieve
I was trying to achieve an automatic link that would allow the user to click on the drawing link and it would open the associated file independent of how they have mapped or reference the network location. It would also automatically update the path should the folder be moved or renamed.
What went wrong? is there a better way of doing this?
Potential Cause
When using the =HYPERLINK formula, excel also generates a hyperlink as if you added one manually by right clicking on the cell. It then also formats the text with an underline and blue/purple text. This "manually" created hyperlink sits on top of the formula so it gets selected first. It is this "manual" hyperlink that does not update.
Work Around
Select all cells with the issue. Right click to bring up the menu and then select remove hyperlink. This removes excels "Manual" hyperlink, but leaves the cells hyperlink formula which still works and is updated.
I have created a hyperlink that connects to the files which exist in the same directory (or subdirectory) as the Excel file. How do I point to the file without setting the full path? The reason I don't want to give the full path is that if I moved the directory which contains other files and the Excel file to a different location, the hyperlinks shouldn't break.
I tried the option below, but the hyperlink only works if I don't move the files.
I want to assign the hyperlink an address like Example\IndexUsage_notes.txt instead of the full path D:\SCRIPTS\ADMIN_SCRIPTS\Example\IndexUsage_notes.txt
After searching online, I found this articles to be useful:
https://www.extendoffice.com/documents/excel/631-excel-file-location.html
This shows you how to get the file path of your workbook and how to isolate the main directory without using Macros.
Then you can insert your main file directory, sub-directory, and filename into the HYPERLINK function.
You can add text to the main directory using TEXT($B$1,0)&TEXT($B$2,0)&......
Dynamic Hyperlink Spreadsheet.png
Once the sub-directories are created and files are in place, you may not be able to move them easily without changing the sub-directory name manually within the spreadsheet or using Macros.
I have written a macro which opens 2 comma delimited files (Generic Tables used by Prophet 8.1 ending with a .fac extension), does a comparison and creates another workbook which highlights all the differences.
The macro seems to fail when the files have the same name but has different directories.
What would be the easiest way to overcome this problem without having to actually change the file name as seen in the location? It is against company policy to mess with the actual files as seen in the location. Is there a way to assign some temporary name to the file and not save it?
In Excel you cannot have two files open with the same name!
If you don't want to rename the files, copy one temporarily using a different name - and delete it afterwards (assuming you only want to read from it)
If you have to modify/save the original files, then the only two options you have is to rename them (you can afterwards rename them back to the original name) - or change your procedure so only one file is open at the time (e.g. by temporarily storing some data from the first file in a temp workbook that gets created and closed during the code execution).