How to make a reference to a cell of another sheet

2019-01-18 05:06发布

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?

2条回答
女痞
2楼-- · 2019-01-18 05:53

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)
查看更多
够拽才男人
3楼-- · 2019-01-18 05:53

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.

查看更多
登录 后发表回答