How to make a reference to a cell of another sheet, when the sheet name is the value of a cell?

末鹿安然 提交于 2019-12-17 19:09:18

问题


In excel 2007, I have a formula in a cell like the following:

=COUNTIFS('2008-10-31'!$C:$C;">="&'$A7)

Now I want to make the name of the sheet ('2008-10-31') be dependent on the value of some cell (say A1). Something like:

=COUNTIFS(A1!$C:$C;">="&'$A7) // error

Is there is way to do this? Or do I have to write a VBA-Macro for it?


回答1:


INDIRECT does what you want. Note that if the sheet name has any spaces, you need to put single quotes round it, ie

=COUNTIFS(INDIRECT("'" & A1 & "'!$C:$C"); ">=" & $A7)



回答2:


You are looking for the INDIRECT worksheet function:

=INDIRECT("SHEET2!A1")
=COUNTIFS(INDIRECT(A1 & "!$C:$C"); ">=" & $A7)

The function turns a string into a real cell reference.



来源:https://stackoverflow.com/questions/258053/how-to-make-a-reference-to-a-cell-of-another-sheet-when-the-sheet-name-is-the-v

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!