proper way to substitute a file name in a formula?

bab01824

Board Regular
Joined
Apr 10, 2003
Messages
53
I have this formula in WORKBOOK A that performs a VLookup in WORKBOOK B;

=IFERROR(IF(ISBLANK(CONSOLIDATION[@[Host Name]]),"",VLOOKUP(TRIM(CONSOLIDATION[@[Host Name]]),INDIRECT("'[WORKBOOK_B_Rev 1.1.0.xlsx]"&CONSOLIDATION[@[SITE-FE]]&"'!$B$9:$J$8361"),7,FALSE)),"Not Found")

This works well. But the file name of the reference workbook changes every time I run this formula, and the formula appears as many as 800 times in the workbook. I've been trying to enter the WORKBOOK B name in a cell in WORKBOOK A and have this formula reference it, but I can't seem to nail down the exact syntax. Can someone give me an example of what it would look like if, for example, the name of WORKBOOK B appears in cell A1 of WORKBOOK A?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You want to use the INDIRECT function

The syntax would be =INDIRECT("'['&A1&".xlsx]worksheetname'!cellref")

Link to an example: http://support.microsoft.com/kb/213933

UPDATE:
I just looked at your formula more closely, and you are already using the INDIRECT function. You can remove the Workbook / File name from the formula and link to it in cell A1. You just need to concatenate before and after the A1 reference as in the syntax above.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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