简体   繁体   English

Excel表格查询值

[英]Excel table Lookup values

I have a table-1 like this: 我有一个这样的表1:

NAMES     ID     
John      1
Bill      2
May       1
Silvia    1
Sam       3
Oren      2

Another table-2: 另一个表2:

ID_To_Compare   name1     name2     name3
1
2
3

I would like to have in table-2 function that gets result like this, according to ID_To_Compare (seeks it in table-1): 根据ID_To_Compare(在表1中查找),我希望在table-2函数中获得这样的结果:

ID_To_Compare    name1     name2     name3
1                John      May       Silvia
2                Bill      Oren
3                Sam

An Excel lookup looks like this; Excel查找如下所示;

=VLOOKUP(I7;Sheet1!$A$2:$F$250;2;FALSE)
  • The first part ( I7 in this case) is the value of the key to find. 第一部分(在这种情况下为I7 )是要查找的键的值。
  • The second part ( Sheet1!$A$2:$F$250 in this case) is the range to search in. 第二部分(本例中为Sheet1!$A$2:$F$250 )是要搜索的范围。
  • The third part ( 2 in this case) is the column index of the queried range from which the value should be read. 第三部分(在这种情况下为2 )是应从中读取值的查询范围的列索引。
  • The last boolean tells whether or not it is a range lookup (in this case we're after a single value). 最后一个布尔值告诉它是否是范围查找(在这种情况下,我们使用的是单个值)。

With your sample data: 使用您的样本数据:

在此处输入图片说明

Formula in cell B10 : 单元格B10公式:

=IFERROR(INDEX($A$1:$A$7,SMALL(IF($B$1:$B$7=$A10,ROW($A$1:$A$7),""),COLUMN(A1))),"")

Confirm through Ctrl Shift Enter 通过Ctrl Shift 确认输入

Drag down and right... 上下拖动...

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

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