Forum Discussion
kczyzyk
Nov 16, 2021Copper Contributor
Reference a cell to grab the sheet name for another cell reference?
I want to use a cell in the current workbook to reference a cell in another workbook. Essentially I have a lot of copies of the same formatted data and I'm trying to compile a summary. Is there a wa...
- Nov 16, 2021
If you mean that you want to reference a cell in another sheet in the same workbook, you can use the INDIRECT function:
=INDIRECT("'"&H2&"'!L11")
This can be filled to the right.
MattWaters
Jan 05, 2023Copper Contributor
Is it possible to do this when referencing a sheet in another workbook? kczyzyk
HansVogelaar
Jan 05, 2023MVP
You can use INDIRECT to refer to a cell in another workbook if that workbook is open in Excel.
INDIRECT does not work with closed workbooks - it will return #REF!
Let's say you want to refer to cell L11 on a sheet whose name is in H2 in a workbook whose name is in G2. As mentioned above, that workbook should be open.
=INDIRECT("'["&G2&"]"&H2&"'!L11")
- MattWatersJan 06, 2023Copper Contributor
Awesome thanks! kczyzyk
Is it possible to hard code the workbook name, but reference the sheet name via indirect possible?
I've tried it along the lines of:
=INDIRECT('[workbook.xls]"&H2&"'!L11)
But can only make it work if I reference both the sheet and the workbook withing the indirect function. Trying to get around it not working if the workbook is closed, as the workbook name will always remain constant.
Hope that makes sense- HansVogelaarJan 06, 2023MVP
It won't work with a closed workbook, even if that is always the same workbook. You'll have to open it in Excel.