Referencing external workbook

Capitano

New Member
Joined
Mar 27, 2003
Messages
24
Dear All,

Trying to select a range of data from a number of workbooks

have created a name that returns the right text to reference this data if it were typed in:

Cell I4 denotes Level Directory
Cell L4 denotes Excel workbook
Cell J5 denotes the Sheet in the workbook


Name Col1:
="'c:\my documents\maths program\level "&Master!$I$4&"\[book "&Master!$L$4&".xls]Sheet"&Master!$J$5&"'!a"&ROW()-2

Any ideas gretfully recieved!

Tim,
Manchester England
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Capitano said:
Dear All,

Trying to select a range of data from a number of workbooks

have created a name that returns the right text to reference this data if it were typed in:

Cell I4 denotes Level Directory
Cell L4 denotes Excel workbook
Cell J5 denotes the Sheet in the workbook


Name Col1:
="'c:\my documents\maths program\level "&Master!$I$4&"\[book "&Master!$L$4&".xls]Sheet"&Master!$J$5&"'!a"&ROW()-2

Any ideas gretfully recieved!

Tim,
Manchester England

You had the right idea; but to get it to work, you need the INDIRECT function

=INDIRECT("'c:\my documents\maths program\level " & Master!$I$4 & "\[book " & Master!$L$4& ".xls]Sheet" & Master!$J$5 &"'!a"& ROW()-2)

(*untested* but I think I've got the syntax right; if not post back.)
 
Upvote 0
Note that the INDIRECT function only works when the referenced workbook (WB) is opened.

The following works with a closed WB.

=VLOOKUP(B18,'C:\My Documents\Temp\Demo.xls'!MyRange,2,FALSE)

where:
B18 in the open WB holds the item to lookup in the closed WB.
Demo.xls is the closed WB and is located at C:\My Documents\Temp\
MyRange refers to $A$1:$B$10 in Demo.xls.

Or, you can reference the range directly:

=VLOOKUP(B18,'C:\My Documents\Temp\[Demo.xls]Sheet1'!$A$1:$B$10,2,FALSE).

Alternative formula (also works with a closed WB):

=INDEX('C:\MyDocuments\Temp\Demo.xls'!MyRange,MATCH(B18,'C:\Documents\Temp\Demo.xls'!Rng,0),2)

Where the named range “Rng” refers to A1:A10 in Demo.xls.


HTH


Mike
 
Upvote 0
Note that the INDIRECT function only works when the referenced workbook (WB) is opened.

The following works with a closed WB.

=VLOOKUP(B18,'C:\My Documents\Temp\Demo.xls'!MyRange,2,FALSE)

where:
B18 in the open WB holds the item to lookup in the closed WB.
Demo.xls is the closed WB and is located at C:\My Documents\Temp\
MyRange refers to $A$1:$B$10 in Demo.xls.

Or, you can reference the range directly:

=VLOOKUP(B18,'C:\My Documents\Temp\[Demo.xls]Sheet1'!$A$1:$B$10,2,FALSE).

Alternative formula (also works with a closed WB):

=INDEX('C:\MyDocuments\Temp\Demo.xls'!MyRange,MATCH(B18,'C:\Documents\Temp\Demo.xls'!Rng,0),2)

Where the named range “Rng” refers to A1:A10 in Demo.xls.


HTH


Mike
Hi Mike,
Thnx for the tips. Isn't it possible to use variables (eg cell references) for the file locations within these formulae though?:eek2:
Thnx in advance for the response(s).
 
Upvote 0

Forum statistics

Threads
1,225,415
Messages
6,184,849
Members
453,263
Latest member
LoganAlbright

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