filtering vlookup formulas in another directory

jroo

Board Regular
Joined
May 22, 2003
Messages
157
Hi,

I have a worksheet set up with 100 records containing the following information.

Column A contains ID codes, which are also the filenames of excel files in the "my documents" directory.

Column B contains the vlookup reference

Column C contains the vlookup formula

example:

A|B|C
ID|Line|Vlookup

123456|8100|=VLOOKUP(B1,'C:\[123456.xls]Sheet1'!$A$1:$B$100,2,FALSE)

654321|8300|=VLOOKUP(B2,'C:\[654321.xls]Sheet1'!$A$1:$B$100,2,FALSE)

111666|8295|=VLOOKUP(B3,'C:\[111666.xls]Sheet1'!$A$1:$B$100,2,FALSE)

....etc

so for the remaining rows i'd like to autofill the vlookup formulas. But I'm having trouble. When I autofill he vlookup reference changes as I want it to (i.e. B4, B5, B6...), HOWEVER, the excel file reference [111666.xls] doesn't change. How do I insert the value in Columns A into "[ .xls]. Any ideas??

I was trying to be clever and so something like ="["&A1&"].xls" and filtering down...but that didn't work

Possibly using vba and doing a find edit replace might be possible as well
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Corni

Active Member
Joined
Mar 2, 2002
Messages
328
You can use this code:

For i=1 to 100
Cells(i,3).Formula="=VLOOKUP(B" & i & ",'C:\[" & Cells(1,1) & _
".xls]Sheet1'!$A$1:$B$100,2,FALSE)"
Next i
 

Forum statistics

Threads
1,148,216
Messages
5,745,440
Members
423,952
Latest member
EduardoM

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
Top