In Excel, you can create a drop down Data Validation list, so it's easy to enter valid items in a cell. Usually, the list of valid items is stored in the same workbook, but it's possible to set up a drop down from a list in another workbook.
在Excel中,您可以创建一个下拉数据验证列表,因此很容易在单元格中输入有效项。 通常,有效项目的列表存储在同一工作簿中,但是可以在另一个工作簿的列表中设置一个下拉列表。
The instructions are below, and watch the video to see the steps. The demo uses Excel 2010, and it's the same in Excel 2007, except that there is an Office button, instead of a File tab.
以下是说明,并观看视频以查看步骤。 该演示使用Excel 2010,与Excel 2007相同,除了有一个Office按钮而不是File选项卡。
从另一个工作簿中的列表下拉 (Drop Down from a List in Another Workbook)
Important Note: For the data validation to work, the workbook that contains the list must be open, in the same instance of Excel. Users will have to open both the workbooks -- the one with the drop down lists, and the workbook with the original source list.
重要说明 :为了使数据验证正常工作,必须在同一Excel实例中打开包含列表的工作簿。 用户将必须打开两个工作簿 -一个带有下拉列表的工作簿,以及一个带有原始源列表的工作簿。
The following instructions are for Excel 2007 and later. On my website, there are similar instructions to create a data validation list from a different workbook in Excel 2003.
以下说明适用于Excel 2007及更高版本。 在我的网站上,有类似的说明,可以从Excel 2003中的另一个工作簿创建数据验证列表。
创建源清单 (Create the Source List)
In this example, you have a workbook named DataValWb.xlsx, which contains a list of customer names. This list is in a range named CustName. (For instructions on creating a named range, refer to Naming Ranges.)
在此示例中,您有一个名为DataValWb.xlsx的工作簿,其中包含客户名称列表。 此列表在名为CustName的范围内。 (有关创建命名范围的说明,请参阅命名范围 。)
创建对源列表的命名引用 (Create a Named Reference to the Source List)
Next, you'll create named range in the workbook where the drop down list will be added.
接下来,您将在工作簿中创建命名范围,将在其中添加下拉列表。
- Open the workbook that contains the source list -- DataValWb.xlsx in this example. 打开包含源列表的工作簿-在此示例中为DataValWb.xlsx。
- Open the workbook in which you wish to use the list in Data Validation, or create a new workbook. 在“数据验证”中打开您要在其中使用列表的工作簿,或创建一个新的工作簿。
-
-
Type a name for the List, e.g. MyCustList
输入列表的名称,例如MyCustList
- From the Scope drop down, select Workbook 从范围下拉列表中,选择工作簿
- Click in the Refers to box -- this is where you'll type a reference to the named range in the source workbook 单击“引用”框-在此处您可以在源工作簿中键入对命名范围的引用
Type an equal sign, then the source workbook name and extension. Do NOT include any square brackets in the name. For example:
键入等号,然后输入源工作簿名称和扩展名。 不要在名称中包含任何方括号。 例如:
=DataValWb.xlsx
= DataValWb.xlsx
OR, if the workbook name includes spaces, start and end the name with an apostrophe. For example: 'DataVal May10.xlsx'
或者,如果工作簿名称包含空格,请在名称的开头和结尾加上撇号。 例如: “ DataVal May10.xlsx”
- Next, type an exclamation mark -- ! 接下来,键入一个感叹号-!
- Finally, type the range name in the source workbook 最后,在源工作簿中键入范围名称
The completed reference should look like this:
完整的参考应如下所示:
=DataValWb.xlsx!CustName
= DataValWb.xlsx!客户名称
OR
要么
='DataVal May10.xlsx'!CustName
='DataVal May10.xlsx'!CustName
- Click OK 点击确定
创建下拉列表 (Create the Dropdown List)
- Select the cells in which data validation will be set. 选择将在其中设置数据验证的单元格。
- On the Ribbon, click the Data tab, then click Data Validation 在功能区上,单击“数据”选项卡,然后单击“数据验证”
- In the Allow box, choose List 在“允许”框中,选择“列表”
In the Source box, type an equal sign, then the list name that you just created, e.g.: =MyCustList
在“源”框中,键入一个等号,然后键入您刚创建的列表名称,例如: = MyCustList
- Click OK 点击确定
使用数据验证列表 (Use the Data Validation List )
Remember, to use the data validation drop down list, both workbooks must be open.
请记住,要使用数据验证下拉列表, 两个工作簿都必须打开 。
- Open both workbooks -- the one with the drop down lists, and the workbook with the original source list. 打开两个工作簿-一个带有下拉列表的工作簿,以及一个带有原始源列表的工作簿。
- Select an item from the data validation drop down list. 从数据验证下拉列表中选择一个项目。
观看视频 (Watch the Video)
Watch this video to see the steps for creating a drop down from a list in another workbook. You'll see how to set up the named ranges, and the drop down lists. The demo is in Excel 2010.
观看此视频,以了解从另一个工作簿中的列表创建下拉列表的步骤。 您将看到如何设置命名范围以及下拉列表。 该演示在Excel 2010中。
翻译自: https://contexturesblog.com/archives/2009/05/12/data-validation-list-from-different-workbook/