简体   繁体   English

使用下拉选择,如果下拉选择在Excel中匹配,则需要返回数据行

[英]Using a Drop Down Selection, need to return rows of data if drop down selections match in Excel

Using Excel only (as I have no access to anything else), I have a table of data which includes the following; 仅使用Excel(因为我无法访问其他任何东西),所以我有一个包含以下内容的数据表;

Faculty/Course/Class/Teacher and then a breakdown of exam results. 教师/课程/班级/教师,然后是考试成绩明细。

what I've been asked to make is a page where the user can use drop down boxes which will then return all the rows that match the drop down selections. 我被要求做的是一个页面,用户可以在其中使用下拉框,然后返回与下拉选择匹配的所有行。

this could either be specific so using Faculty/Course/Teacher or just faculty etc. 这可以是特定的,因此可以使用教职员工/课程/老师,也可以只使用教职员工等。

Is this possible? 这可能吗? I'm handy with Vlookups, but not when it comes to multiple lookup values. 我对Vlookups很方便,但在涉及多个查找值时却不这样。

File hosted on dropbox if it helps? 是否可以将文件托管在保管箱上?

https://www.dropbox.com/sh/gzjx0htts17p7yn/AAAIec6KaG9S8UXXsru8hU0oa?dl=0 https://www.dropbox.com/sh/gzjx0htts17p7yn/AAAIec6KaG9S8UXXsru8hU0oa?dl=0

I have a method you could try (bearing in mind it does need the lookup column in your data sheet to be sorted). 我有一种您可以尝试的方法(请记住,它确实需要对数据表中的查找列进行排序)。 In your second - lookup sheet, you will need to use the first column as an indexing helper column. 在第二个查找表中,您需要将第一列用作索引帮助器列。

For my test data - I entered 10 rows for the test to begin: 对于我的测试数据-我输入了10行以开始测试:

In A3 I added this formula - =MATCH($A$1,Data!$A$1:$A$17,0) (adjust accordingly) which is merely used to locate the first instance of your validated value (I put it in A1). 在A3中,我添加了此公式- =MATCH($A$1,Data!$A$1:$A$17,0) (据此进行调整),该公式仅用于查找已验证值的第一个实例(我将其放在A1中) 。 This will return its row number. 这将返回其行号。

Below I added 9 iterative numbers that add onto that value - so if it returned 2, the row below would be 3, then 4 and so on. 在下面,我添加了9个迭代数字,并将其添加到该值上-因此,如果返回2,则下面的行将是3,然后是4,依此类推。

Then in B3 I added an index formula =IF(ISERROR(IF(INDEX(Data!$A$1:$A$17,Test!A3,1)<>$A$1,"",INDEX(Data!$A$1:$A$17,Test!A3,1))),"",IF(INDEX(Data!$A$1:$A$17,Test!A3,1)<>$A$1,"",INDEX(Data!$A$1:$A$17,Test!A3,1))) 然后在B3中,我添加了一个索引公式=IF(ISERROR(IF(INDEX(Data!$A$1:$A$17,Test!A3,1)<>$A$1,"",INDEX(Data!$A$1:$A$17,Test!A3,1))),"",IF(INDEX(Data!$A$1:$A$17,Test!A3,1)<>$A$1,"",INDEX(Data!$A$1:$A$17,Test!A3,1)))

I know this looks fairly grim, but all its doing is checking if returning the index - based upon the value in A3, matches your lookup value and also whether there is an error (which could happen for the bottom rows of your data sheet) 我知道这看起来很严峻,但是它所做的只是检查是否返回索引-基于A3中的值,是否与您的查找值匹配,以及是否存在错误(这可能发生在数据表的底行)

This will then return the value in the first column. 然后,它将在第一列中返回该值。 For subsquent columns - you could use =IF($B$3<>"",INDEX(Data!$A$1:$E$17,Test!$A3,COLUMN(B1))) 对于后续列-您可以使用=IF($B$3<>"",INDEX(Data!$A$1:$E$17,Test!$A3,COLUMN(B1)))

I hope that gets you on the right track. 我希望这能使您走上正确的道路。

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

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