简体   繁体   English

Excel动态公式/参考工作簿

[英]Excel Dynamic Formula/Reference Workbook

I'm trying to create a dynamic reference within a formula; 我正在尝试在公式中创建动态引用; meaning the referenced workbook and subsequent sheet name can be changed and the appropriate data loaded. 意味着可以更改引用的工作簿和后续工作表名称,并加载适当的数据。

在此处输入图片说明

I'm aware that a static formula reference could be done as follows: 我知道可以按以下方式完成静态公式引用:

=SUM('C:\Reports\[SOTDJ17.xlsx]Summary'!C10:C25)

but I want to be able to change the workbook name, and it will reference information from that particular workbook and change the data. 但是我希望能够更改工作簿名称,并且它将引用该特定工作簿中的信息并更改数据。 The workbook name is stored in B5 and the sheet is stored in B8. 工作簿名称存储在B5中,工作表存储在B8中。 I thought I might be able to use something simple like: 我以为我可以使用一些简单的方法:

=SUM('C:\Reports\[B5]B8'!C10:C25)

but it doesn't seem to work. 但它似乎不起作用。 Is there a syntax error or something else I am missing? 是否有语法错误或其他我想念的东西?

(I should note that I am trying to reference a closed workbook) (我应该注意,我正在尝试引用已关闭的工作簿)

You'll want to use Indirect() : 您将要使用Indirect()

=SUM(INDIRECT("["&B5&"]"&B8&"!$C$10:$C$25"))

Note that the workbook you're referring to must be open. 请注意,您引用的工作簿必须处于打开状态。

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

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