[英]Excel - Lookup value in multiple columns
I have a datasheet with multiple columns that I want to search through - ending up with returning the top row value(s) in the found column(s). 我有一个要搜索的具有多个列的数据表-最后返回所找到的列中的顶行值。 How to do this? 这个怎么做?
My idea would be to combine index with match, but I am rather lost for specific ideas... 我的想法是将索引与匹配结合起来,但是我对特定的想法迷失了……
January February March April May June
1 2 3 4 5 6
7 8 9 10 11 12
2 7 1 8 4 5
9 10 11 12 6 3
Eg Search for: ID 3 - should return: March, June 例如,搜索:ID 3-应该返回:6月,3月
Regards, 问候,
Nyborg 尼堡
You need to add a VLOOKUP for each columns and after build the result 您需要为每列添加一个VLOOKUP,并在生成结果后
Following the Scheme: 遵循计划:
A7 -> =IF(IFERROR(VLOOKUP($A$9;A1:A5;1;);"")="";"";A1) and autocomplete
D9 -> =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(CONCATENATE(A7;",";B7;",";C7;",";D7;",";E7;",";F7);",,";",");",,";",");",,";",")
D10 -> =IF(RIGHT(D9;1)=",";LEFT(D9;LEN(D9)-1);D9)
Formula for D9 & D10 it's only to have a good display of the results. D9和D10的公式只能很好地显示结果。
UPDATE Version: Considering you agree to have the Row 7 ... You can simplyfy using the Result formula: 更新版本:考虑到您同意使用第7行...您可以使用Result公式简单地完成:
=INDEX(List;SMALL(IF(List<>"";COLUMN(List)-MIN(COLUMN(List))+1);1))&IFERROR(", " & INDEX(List;SMALL(IF(List<>"";COLUMN(List)-MIN(COLUMN(List))+1);2));"")&IFERROR(", " & INDEX(List;SMALL(IF(List<>"";COLUMN(List)-MIN(COLUMN(List))+1);3));"")
List it's the name Range of Row 7. The formula shall be apply with Ctrl+Shift+Enter. 列出它的名称为第7行的范围。该公式应按Ctrl + Shift + Enter进行应用。
This formula collect the first 3 value. 此公式收集前3个值。
If you want more, add for each nth value you have: 如果需要更多,请为每个具有的nth值添加:
&IFERROR(", " & INDEX(List;SMALL(IF(List<>"";COLUMN(List)-MIN(COLUMN(List))+1);3));"")
changing the last numer (in this case 3) and putting 4, 5, 6 ... 更改最后一个数字(在本例中为3),然后放入4,5,6 ...
Obviusly if the result can be a lot, have few sense... Consider to use VBA ! 显然,如果结果可能很多,则毫无意义... 考虑使用VBA!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.