微信公众号:真是一天世界
今天介绍 indirect 函数的第二种经典应用:制作多级联动下拉菜单。
我用的版本是 Excel 2016,其他版本的界面可能略有不同。
案例:
怎么把下表做成二级联动菜单?选择队名,队员的列表随之联动?
![921d67c7e86f51c98b5175d82b871440.png](https://img-blog.csdnimg.cn/img_convert/921d67c7e86f51c98b5175d82b871440.png)
![149b8bf9ca441252ff12386e9e982b5f.png](https://img-blog.csdnimg.cn/img_convert/149b8bf9ca441252ff12386e9e982b5f.png)
解决方案:
1. Ctrl+F3 新建名称
![8e616b528f4c93fcf5c00fbad5437f8b.png](https://img-blog.csdnimg.cn/img_convert/8e616b528f4c93fcf5c00fbad5437f8b.png)
2. 在 Name 栏位输入对应的队名,Refers to 栏位选择该队的人员。依次类推,建立八个队的列表
![6aefa90972e37dae55f04d368cb5bded.png](https://img-blog.csdnimg.cn/img_convert/6aefa90972e37dae55f04d368cb5bded.png)
![2c0d489725df1e01f0410c55cc1cb438.png](https://img-blog.csdnimg.cn/img_convert/2c0d489725df1e01f0410c55cc1cb438.png)
3. 按基本步骤制作队名下拉菜单,具体步骤不赘述,基础操作,本号受众应该都会
![134b890f9e47b0db4ec5bb8168124d77.png](https://img-blog.csdnimg.cn/img_convert/134b890f9e47b0db4ec5bb8168124d77.png)
![77b4933258a7da79a8ff7f008bf19658.png](https://img-blog.csdnimg.cn/img_convert/77b4933258a7da79a8ff7f008bf19658.png)
4. 制作队员下拉菜单,在 Source 栏位中输入以下公式,二级联动菜单就已经完成:
=INDIRECT($J2)
- 这是indirect函数不加 ”” 的用法,相当于调用队名的值
- 记得删除行号 2 前面的绝对引用标识 $,这样下拉拖动的时候,公式调用的行号会随行数变化
![2db4a23881dd869e5701151370fb9bba.png](https://img-blog.csdnimg.cn/img_convert/2db4a23881dd869e5701151370fb9bba.png)
![149b8bf9ca441252ff12386e9e982b5f.png](https://img-blog.csdnimg.cn/img_convert/149b8bf9ca441252ff12386e9e982b5f.png)
那么问题来了!我们原来的队名队员表是这样的,除了复制粘贴,有没有其他办法把它快速变成本例所需的 2 维表?
请听下回分解……
![a65002b52ed4242310373249b87c59c5.png](https://img-blog.csdnimg.cn/img_convert/a65002b52ed4242310373249b87c59c5.png)
![921d67c7e86f51c98b5175d82b871440.png](https://img-blog.csdnimg.cn/img_convert/921d67c7e86f51c98b5175d82b871440.png)