Linking to Excel file - filename specified indirectly

Pedro-G

New Member
Joined
Dec 15, 2005
Messages
46
I don't have the English version of Excel, so some English terms I use may be unusual or incorrect. Please bear with me.


I'd like to make refrenses (or links) and lookups to other Excel files, but I need to define the actual filename in another cell in the referensing spreadsheet.

I try to clarify with a couple of very simple examples. Say I have two Excel files, Master.xls and Slave.xls. Normally in the Master.xls I would make a link to cell C4 in Slave.xls as follows:

='C:\Foldername\[Slave.xls]Sheetname'!$C$4

That works. However, instead of writing the [Slave.xls] in the formula itself, I would like it to look up the filename from another cell in the Master.xls.

I know the following doesn't work, but it maybe gives a picture of what I'm asking for:

='C:\Foldername\[[A2].xls]Sheetname'!$C$4

...and A2 would contain the text "Slave". Is there a way to format it so that it works? Couldn't find it from the helpfiles or searching this site (and others).

Also acceptable (but not preferred) would be that the cell A2 contains the whole filename including the .xls extension, such as "Slave.xls" instead of just "Slave".
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Re: Linking to Excel file - filename specified "indirec

Pedro-G said:
I don't have the English version of Excel, so some English terms I use may be unusual or incorrect. Please bear with me.


I'd like to make refrenses (or links) and lookups to other Excel files, but I need to define the actual filename in another cell in the referensing spreadsheet.

I try to clarify with a couple of very simple examples. Say I have two Excel files, Master.xls and Slave.xls. Normally in the Master.xls I would make a link to cell C4 in Slave.xls as follows:

='C:\Foldername\[Slave.xls]Sheetname'!$C$4

That works. However, instead of writing the [Slave.xls] in the formula itself, I would like it to look up the filename from another cell in the Master.xls.

I know the following doesn't work, but it maybe gives a picture of what I'm asking for:

='C:\Foldername\[[A2].xls]Sheetname'!$C$4

...and A2 would contain the text "Slave". Is there a way to format it so that it works? Couldn't find it from the helpfiles or searching this site (and others).

Also acceptable (but not preferred) would be that the cell A2 contains the whole filename including the .xls extension, such as "Slave.xls" instead of just "Slave".

Download and install the morefunc.xll add-in in order to work with closed files...

=INDIRECT.EXT("'C:\Foldername\["&A2&"]Sheetname'!C4")
 
Upvote 0
Re: Linking to Excel file - filename specified "indirec

Aladin Akyurek said:
Download and install the morefunc.xll add-in in order to work with closed files...

=INDIRECT.EXT("'C:\Foldername\["&A2&"]Sheetname'!C4")

Thanks for the answer.

However, I need this at work and I don't have the admin rights for WindowsXP to install it. Of course I could ask to have it installed on my computer, but hundreds of other people at my company will use my spreadsheet and would therefore need to install the morefun.xll. It's just not possible to install add-ins for all of them.

Any other suggestions?
 
Upvote 0
Re: Linking to Excel file - filename specified "indirec

Pedro-G said:
Aladin Akyurek said:
Download and install the morefunc.xll add-in in order to work with closed files...

=INDIRECT.EXT("'C:\Foldername\["&A2&"]Sheetname'!C4")

Thanks for the answer.

However, I need this at work and I don't have the admin rights for WindowsXP to install it. Of course I could ask to have it installed on my computer, but hundreds of other people at my company will use my spreadsheet and would therefore need to install the morefun.xll. It's just not possible to install add-ins for all of them.

Any other suggestions?

Morefunc allows itself to be included in the workbook that you want to distribute.

If the target file is open at any time it's needed, you can replace INDIRECT.EXT with INDIRECT.
 
Upvote 0
Re: Linking to Excel file - filename specified "indirec

Aladin Akyurek said:
Morefunc allows itself to be included in the workbook that you want to distribute.

If the target file is open at any time it's needed, you can replace INDIRECT.EXT with INDIRECT.

Okay, I tried with Morefunc and it seems to work! For references to specified cells, anyway - like I had in my example. I still have some rough edges, but I hope I'll sort them out.

Now, how to do the same using the VLookup function? I mean, search in another closed file, and specify the filename in another cell.

I tried using VLookup and entering ["&A2&"] instead of the filename. The filename Slave.xls was in the cell A2. Excel popped up a browser screen for me to select which file I mean, it didn't look it up from cell A2. After that, it worked for that one session, but when I close and open the Master.xls file, the link dosn't work any more. If I manually update the link, every time it pops me the browser window to point out the file again. It doesn't even matter if I type ["&garbage&"] instead of ["&A2&"] in the VLOOKUP funtion; Excel doesn't even try to use the A2 cell for seeing the filename.

Any ideas?
 
Upvote 0
Re: Linking to Excel file - filename specified "indirec

Pedro-G said:
Aladin Akyurek said:
Morefunc allows itself to be included in the workbook that you want to distribute.

If the target file is open at any time it's needed, you can replace INDIRECT.EXT with INDIRECT.

Okay, I tried with Morefunc and it seems to work! For references to specified cells, anyway - like I had in my example. I still have some rough edges, but I hope I'll sort them out.

Now, how to do the same using the VLookup function? I mean, search in another closed file, and specify the filename in another cell.

I tried using VLookup and entering ["&A2&"] instead of the filename. The filename Slave.xls was in the cell A2. Excel popped up a browser screen for me to select which file I mean, it didn't look it up from cell A2. After that, it worked for that one session, but when I close and open the Master.xls file, the link dosn't work any more. If I manually update the link, every time it pops me the browser window to point out the file again. It doesn't even matter if I type ["&garbage&"] instead of ["&A2&"] in the VLOOKUP funtion; Excel doesn't even try to use the A2 cell for seeing the filename.

Any ideas?

=VLOOKUP(LookupValue,INDIRECT.EXT(...),ReturnColumn,MatchType)

You need to give a table range to INDIRECT.EXT.
 
Upvote 0
Re: Linking to Excel file - filename specified "indirec

Aladin Akyurek said:
=VLOOKUP(LookupValue,INDIRECT.EXT(...),ReturnColumn,MatchType)

You need to give a table range to INDIRECT.EXT.

Thanks a million for your answers so far. However, I didn't quite understand this one. I tried to read up on this, but couldn't figure it out how to enter the name of the external file in another cell, where the filename can be changed by just changing the contents of that cell.

All the closed external files into which I'll be doing the VLOOKUP are three letters long, such as HJU.xls, PLY.xls and so forth. Let's say that:

- LookupValue is entered in cell A1
- Table Range in the external file is K1:L10
- External filename is entered in cell A2
- ReturnColum is 2
- MatchType is FALSE

Could you please give me the exact formula, using that info? With the correct quotes, semicolons and stuff. I'm sorry to be such a pain, but I've been busting my brain, I just get errors.
 
Upvote 0
Re: Linking to Excel file - filename specified "indirec

Pedro-G said:
All the closed external files into which I'll be doing the VLOOKUP are three letters long, such as HJU.xls, PLY.xls and so forth. Let's say that:

- LookupValue is entered in cell A1
- Table Range in the external file is K1:L10
- External filename is entered in cell A2
- ReturnColum is 2
- MatchType is FALSE

Ok, finally figured it out myself. Turns out that I had to learn to use the &'s and "'s the hard way. In case someone else ever fumbles with the same question, here is the formula using the above mentioned data, plus the fact that the external files are located at C:\Datafiles\ :

=VLOOKUP(A1;INDIRECT.EXT("'C:\Datafiles\["&A2&".xls]Sheetname'!$K$1:$L$10");2;FALSE)
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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