Say I have the following formula in a cell that reads the value of a cell from another work book
='c:\temp\[external book.xlsx]SheetX'!$E$4
and I want the value of c:\temp\[external book.xlsx]SheetX
to come from another cell in this sheet. How would I rewrite this formula to concatenate this value and "!$E$4"
Lets say the cell A1
contains c:\temp\[external book.xlsx]SheetX
EDIT: As the below won't work on a closed workbook, here is a clunky proof-of-concept of how you could do it with VBA (I imagine there are better ways of doing this):
OLD WAY (doesn't work on closed workbooks)
I believe this captures what you're looking for. In this example, cell
A1
had my sheet path:In cell B1 I have the formula:
Which concatenates the sheet value with
$E$4
in order to generate the full path, which is then turned into a value byINDIRECT
. One thing to note: the apostrophe is an escape character, so depending on your data, you may have to account for it specially in your formula:If you're using Excel 2007 or above, you could wrap it in an
IFERROR
formula to take out the guesswork: