简体   繁体   English

如何将多个值映射到下拉列表中的单个项目并显示相应的单元格内容?

[英]How to map multiple values to a single item on a drop-down list and display the corresponding cell content?

I'm creating an Excel database with large amounts of information and i want this information to display on a "summary" sheet upon selecting a certain item on a drop-down list. 我正在创建一个包含大量信息的Excel数据库,我希望在选择下拉列表中的某个项目时,此信息显示在“摘要”表上。 For example, if i select A from the drop-down list in Sheet1, i want content from B1:B10 in Sheet2 to display in Sheet1. 例如,如果我从Sheet1的下拉列表中选择A,我希望Sheet2中的B1:B10中的内容显示在Sheet1中。 I tried both IF and VLOOKUP's but couldn't figure out a solution. 我尝试了IF和VLOOKUP,但无法找到解决方案。 Note that all the information is text-only and there's no such mathematical calculation involved. 请注意,所有信息都是纯文本的,并且不涉及此类数学计算。 Thanks in advance! 提前致谢!

Say in Sheet2 we have data like: Sheet2中说我们有以下数据:

在此输入图像描述

and in Sheet1 cell A1 we have a drop-down like: Sheet1单元格A1中,我们有一个下拉列表:

在此输入图像描述

We would like to pick a name (like David) and see all the data associated with David. 我们想选择一个名字(如David),并查看与David相关的所有数据。

In Sheet2 cell C1 we enter: Sheet2单元格C1中输入:

=IF(Sheet1!$A$1="","",IF(A1=Sheet1!$A$1,1,""))

and in cell C2 we enter: 在单元格C2中我们输入:

=IF(Sheet1!$A$1="","",IF(A2=Sheet1!$A$1,1+MAX($C$1:C1),""))

and copy this downwards. 并向下复制。 Column C will mark the rows of interest. C列将标记感兴趣的行。 If we pick David in Sheet1, Sheet2 now looks like: 如果我们在Sheet1中选择David ,则 Sheet2现在看起来像:

在此输入图像描述

Now all we have to do is gather the items of interest. 现在我们所要做的就是收集感兴趣的物品。 In Sheet1 cell A2 we enter: Sheet1单元格A2中输入:

=IF(ROWS($1:1)>MAX(Sheet2!C:C),"",INDEX(Sheet2!B:B,MATCH(ROWS($1:1),Sheet2!C:C)))

and copy down. 并复制下来。 Sheet1 now displays: Sheet1现在显示:

在此输入图像描述

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

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