问题
I have some dynamic input, in my case, the name of the month in cell I25. Based on the month the function in cell H32 should reference a sheet with the name of the month and cell A18 within that sheet. Now this I can handle and have made it possible through the INDIRECT function.
The issue I'm having is with dynamic range. For example, I would like cell H33 to reference cell A19 within the worksheet "February". The closest I got to it was =INDIRECT($I$25"&"!A18:A200")
. And it seems to be working, but for some strange reason it starts referencing the cells contents from A36 onwards, which I don't get. Suggestions?
Any help would be greatly appreciated.
回答1:
Use this one in H32
and drag it down:
=INDIRECT("'" & $I$25 & "'!" & CELL("address",A18))
Notes:
- I've changed
$I$25 & "!"
to"'" & $I$25 & "'!"
in formula to make it more reliable (for the case when sheet name contains spaces you should include your sheet name in single quotes like this:'My sheet'!A18
) - In
H32
this formula evaluates to=Feb!A18
(whereFeb
is your sheet name), inH33
to=Feb!A19
and so on.
来源:https://stackoverflow.com/questions/22437086/dynamic-indirect-formula-with-range