How to dynamically reference to another cell in other workbooks? - excel

i'm trying to create an excel workbook that will automatically collect data from other workbooks in the directory i come up with a code but it does not work correctly
="'"&LEFT(CELL("filename",$A$1),FIND("~",SUBSTITUTE(CELL("filename",$A$1),"[","~",1))-1)&"["&RIGHT(LEFT(CELL("filename",$A$1),FIND("~",SUBSTITUTE(CELL("filename",$A$1),"[","~",1))-2),3)&RIGHT(LEFT(CELL("filename",$A$1),FIND("~",SUBSTITUTE(CELL("filename",$A$1),"[","~",1))+16),1)&".xlsx]Final Data'!"&E3
if i use this code it will call the value of the E3 in the current workbook if i use ADDRESS(3,5) it will give me the right address but the moment i put =INDIRECT() before it, the value of E3(in the current workbook) will come up (the other file is open since i'm using indirect). how can i correct this and is there a way to get ell values while the file is closed ?

Related

Retrieving data between OneDrive files using formula

I'm trying to set up a shared workbook that will collect data from other workbooks onto one sheet. All the files are in the same folder on OneDrive and need to be used by multiple people.
I started by just making a test workbook and opened one of the other workbooks in the same directory as well. Then in the test workbook in one cell I put = and then clicked on a cell from the other workbook and hit enter. This brought through the data from that cell into the test workbook. When I closed the file it converted it into a web address for the file and kept the data. eg:
='http://ourprojects.sharepoint.com/sites/TeamName/FolderName/[Project Name.xlsx]Sheet1'!$A$1
So far so good.
Now the issue is in the main file I need to pull that data from multiple files in the directory that will change as and when projects start/end so I need to build up the formula in parts. So the main web address stays the same, for example "http://ourprojects.sharepoint.com/sites/TeamName/FolderName/" the rest I need to build up depending on what the user fills in.
So ideally I want the user to put in the project name (which will be the same as the workbook name) and the cell they need the data from. Meaning I have 4 things I want to combine:
A1 is Web address = http://ourprojects.sharepoint.com/sites/TeamName/FolderName/
B1 is Workbook Name = Project One
C1 is Sheet Name = Sheet1
D1 is Cell needed = A1
and then in a 5th cell, E1, these are combined to make the filepath to bring in the data:
='http://ourprojects.sharepoint.com/sites/TeamName/FolderName/[Project One.xlsx]Sheet1'!$A$1
I can't for the life of me get this working. I've googled a fair bit and found lots of different answers/solutions from all over including this site but non have worked.
If anyone can help me it would be appreciated.
I did get something kind of working with indirect but obviously that only works with the file open which kind of defeats the aim of this totally. I want this new file to just pull the data in so it gives an overview of everything without having to open them all one by one.

Excel Dynamic Formula/Reference Workbook

I'm trying to create a dynamic reference within a formula; meaning the referenced workbook and subsequent sheet name can be changed and the appropriate data loaded.
I'm aware that a static formula reference could be done as follows:
=SUM('C:\Reports\[SOTDJ17.xlsx]Summary'!C10:C25)
but I want to be able to change the workbook name, and it will reference information from that particular workbook and change the data. The workbook name
is stored in B5 and the sheet is stored in B8. I thought I might be able to use
something simple like:
=SUM('C:\Reports\[B5]B8'!C10:C25)
but it doesn't seem to work. Is there a syntax error or something else I am missing?
(I should note that I am trying to reference a closed workbook)
You'll want to use Indirect():
=SUM(INDIRECT("["&B5&"]"&B8&"!$C$10:$C$25"))
Note that the workbook you're referring to must be open.

Reference a file that changes daily / Excel

Before I jump into a VBA solution, I wanted to know if it was possible to update a filename of a closed workbook I am referencing.
The formula reads,
=SUMIF('L:path\[filename - "&TEXT(WORKDAY(TODAY(),-1),"yyyymmdd")&".xlsx]Sheet'!$BF:$BF,"criteria",'L:path\[filename - "&TEXT(WORKDAY(TODAY(),-1),"yyyymmdd")&".xlsx]Sheet'!$DX:$DX)
To clarify, the path the filename would look something like this, This is the filename - yyyymmdd.xlsb
Someone at work said it's not possible to change the filename because it's a string. If that is the case could someone just expand on that a bit?
You can't really. If you have "Book1.xls" and "Book2.xls", what you can do it put this formula in book1:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]", CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)
This will return the name (only) of Book1. You could then reference that cell from Book2. HOwever, if you change Book1's name to something else, the reference will be broken and you will have to manually change the reference (pick the file from the update link manager). It seems excel uses absolute paths, including filename, to reference other workbook. You would need to have a way to store a flexible reference to that workbook into Book2. But the only way to do is VBA.
Interestingly however you can do that:
Create a reference in book2 pointing to a cell in book1. You get the value of that cell in book2.
Close everything.
Open only book1, edit the referenced cell. Close & save book1.
Book2, when you open it, will ask you if you want to update the link, and you can see the updated value even if book1 is still closed.
The other idea that I had was to use INDIRECT, like what is done there: using indirect function in Excel
But it won't work for closed workbook and that's one of your requirements.
So VBA it is.

how to lookup image from different excel

I am creating an excel workbook file with one of the column containing a title of an image that is in another excel workbook file, that excel file contained huge database of images how to lookup images form that excel workbook file with their individual title
Note: these are two different Excel workbooks. And the condition is we can't merge file because imageDatabase file is so heavy up to 25MB for that reason excel is get not responding or force close.
file for example:
https://drive.google.com/a/flygoldfinch.com/file/d/0B9VV_J4sKTatdDBEZ01GNHg3Y0k/view?usp=docslist_api
Any reference to a cell in Excel can be performed on any other sheet, be it in the same file, or an outside file.
A reference to another sheet within the file looks like this:
='sheetname'!M20
The same thing works if that sheet is in a different file
='[file.xlsx]sheetname'!$H$726
Knowing that the reference will work that way, you can write any formula with it. This includes VLOOKUPs, or anything else you need to do.
A good shortcut to make this easier is to have both files open, click the cell you want to make the reference in, type =, then switch to the other file, click the cell you want, and hit return. Your reference is made.

Dynamically reference cell in different workbook

I have two workbooks:
WorkbookToUpdate.xls
Workbook_for_20130901.xls
In the first workbook I have the following:
A1 ='[Workbook_for_20130901]Sheet1'!$C5
Now a month goes by and I want to update the first work to reference Workbook_for_20131001.xls without going cell by cell and changing the name of the workbook. My thought was to make the date portion of the workbook name a variable and simply change that variable, but that doesn't seem to be working.
EDIT: I don't want to use Excel's INDIRECT function because I don't want to open the reference workbook.
I found one solution to be Harlan Grove’s PULL function (code can be found here), which works similarly to the INDIRECT function except that it doesn't require the source workbook to be open. The other solution, which actually works out to be faster than the Pull function (its only downfall) is the one I was using originally - Good ol' "find & replace". I thought that that was slow, but after trying the Pull function, it's not too bad.
Another option is by changing the source through excel's Data links, but this doesn't allow you to choose which cells keep the old source and which cells use the new one (in my case, I need the old values as well).

Resources