简体   繁体   English

如何使用单元格中写入的工作表名称引用工作表中的单元格

[英]How to reference a cell in sheet using the sheetname written in cell

I have "Week 1", "Week 2", "Week 3".... as my headers in cells A1, B1, C1.... 我将“周1”,“周2”,“周3” ....作为标题放在单元格A1,B1,C1 ....中。

I also have "Week 1", "Week 2", "Week 3".... sheet names. 我也有“第1周”,“第2周”,“第3周” ....工作表名称。

In the second row, I would like to reference to corresponding sheets' cells. 在第二行中,我想引用相应的工作表单元格。 For example in cell A2, I gives have tried indirect function INDIRECT(A1) but it gives #ref error. 例如,在单元格A2中,我给出了尝试过的间接函数INDIRECT(A1)但它给出了#ref错误。 I actually want to reference sheet Week 1, but all I can imagine is this function =SHEETS(INDIRECT(A1)) . 我实际上想参考第1周的工作表,但我只能想象到此函数=SHEETS(INDIRECT(A1)) Of course I have the same error again. 当然我又有同样的错误。

I want to reference to sheet "Week 1" cell A2, by using current sheet's A1 value ("Week 1") in the formula. 我想通过在公式中使用当前工作表的A1值(“工作周1”)来引用工作表“周1”单元格A2。

Any help is appreciated. 任何帮助表示赞赏。

You need to put the sheet name in brackets in the INDIRECT . 您需要将工作表名称放在INDIRECT方括号中。

=INDIRECT(A1&"!A2")

For a different workbook, you use brackets: 对于其他工作簿,请使用方括号:

=INDIRECT("["&A1&"]A2")

So you can combine them: 因此,您可以将它们结合起来:

=INDIRECT("["&A1&"]"&A2&"!B1")

You use the function incorrectly. 您使用该功能不正确。 The proper usage is =INDIRECT("A1") by using "". 正确的用法是通过使用“” =INDIRECT("A1")

As for your questions, to be able to reference a sheet name by using cell value, you need to use INDIRECT and ADDRESS function, not SHEET function. 对于您的问题,要能够通过使用单元格值来引用工作表名称,您需要使用INDIRECTADDRESS函数,而不是SHEET函数。 Sheet function returns the number of sheets. 图纸功能返回图纸数量。

The proper function you are looking for is =INDIRECT(ADDRESS(2,1,,,A1)) 您要寻找的正确函数是=INDIRECT(ADDRESS(2,1,,,A1))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM