[英]How to use cell value as worksheet name in another workbook using the vlookup function?
I have two separate workbooks, one called Form.xlsx and one called Database.xlsx . 我有两本单独的工作簿,一本叫做Form.xlsx ,另一本叫做Database.xlsx 。 While in Form.xlsx the user will select a value from a dropdown in cell C3.
在Form.xlsx中 ,用户将从单元格C3的下拉列表中选择一个值。 I would like for the value to then be used as the Worksheet name in the Database.xlsx workbook.
我希望将该值用作Database.xlsx工作簿中的工作表名称。
For Example: 例如:
The C3 drop down list will be: C3下拉列表将为:
When a user selects say Florida from the dropdown, I would then like for that value to be plugged into a vlookup statement as the worksheet name like: 当用户从下拉列表中选择说佛罗里达时 ,我希望将该值作为工作表名称插入vlookup语句中,例如:
=vlookup(C3,'C:\\Users\\Williasa\\[Database.xlsx]Florida!$B$4:$F$6,5,FALSE)
Is there any way that I can do that? 有什么办法可以做到吗? If possible I would like to stay away from a INDIRECT statement since the Database.xlsx workbook will not be open when users are using the Form.xlsx.strong text
如果可能的话,我想避免使用INDIRECT语句,因为当用户使用Form.xlsx.strong文本时,Database.xlsx工作簿不会打开
EDIT 编辑
I feel like I need to clarify something here. 我觉得我需要在这里澄清一些事情。
On the Form is another drop-down criteria with 3 options in it in cell B14 : 表格上的另一个下拉条件在单元格B14中具有3个选项:
I would like the vlookup to first take me to the correct worksheet defined by cell C3 (Florida, Ohio, or Indiana), search A7:A9 for the B14 drop-down value that matches, then bring in the cell value of B7:B9 to the original cell where I am running this formula. 我希望vlookup首先将我带到单元格C3 (佛罗里达,俄亥俄州或印第安纳州)定义的正确工作表,在A7:A9中搜索匹配的B14下拉值,然后输入B7:B9的单元格值到我运行此公式的原始单元格。
I apologize if I am using incorrect wording, trying my best to explain it! 如果使用不正确的措词,我们深表歉意!
If the drop-down list is small and constant or changes rarely, you could do something like: 如果下拉列表很小且恒定,或者很少更改,则可以执行以下操作:
CHOOSE(X,'C:\Users\Williasa\[Database.xlsx]Florida'!$B$4:$F$6, 'C:\Users\Williasa\[Database.xlsx]Ohio'!$B$4:$F$6, 'C:\Users\Williasa\[Database.xlsx]Indiana'!$B$4:$F$6)
Where X
is a formula equal to the index of the dropdown choice (so 1 for Florida). 其中
X
是等于下拉选项的索引的公式(对于Florida,则为1)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.