Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
817 views
in Technique[技术] by (71.8m points)

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...