0

I am trying to create a vlookup with a condition, link. All combinations are unique, so Chicken - Sausage will only appear once. I have checked my formula and this is what happens;

  1. Formula checks column A for any cells that match Chicken.
  2. Result is FALSE/FALSE/TRUE/TRUE/FALSE/TRUE/...
  3. Formula filters out all the falses and returns the data of the trues.
  4. Retrieved data is all #N/A
  5. Result = #N/A

But why is all the retrieved data #N/A? It should list Chicken x x x x Sausage/.... Other columns are of no use or interest in this question.

=VLOOKUP("Sausage";IF(Extra!$A$2:$A$4032="Chicken";Extra!$A$2:$H$4032;"");7;0)

Data Sample

Extra
Meat     x x x x x Sausage
Chicken  x x x x x Sausage 
Turkey   x x x x x Sausage
Chicken  x x x x x Breast
Chicken  x x x x x Wings

Jerry:

Hi Jerry, I want to look for Sausage in Sheet Extra. With a normal VLOOKUP it will only show the first result, even if you 3 results (Chicken Sausage, Meat Sausage, Turkey Sausage). So I added an extra condition, Chicken. Following the link I provided I'm looking for Sausage (A) in Sheet Extra and it's linked to Chicken (South-America).

This should result in:

=VLOOKUP("A",{"", "", "", "", "";"", "", "", "", "";"", "", "", "", "";"", "", "", "", "";"A", "South America", "The New Firm", "Tory", "Byrnes";"", "", "", "", "";"", "", "", "", "";"", "", "", "", "";"", "", "", "", "";"F", "South America", "Trans United Airways", "Ervin", "Hennessey"},3,FALSE)

But all I get is:

=VLOOKUP("Sausage",{"", "", "", "", "";"", "", "", "", "";"", "", "", "", "";"", "", "", "", "";"#N/A", "#N/A", "#N/A", "#N/A", "#N/A";"", "", "", "", "";"", "", "", "", "";"", "", "", "", "";"", "", "", "", "";"#N/A", "#N/A", "#N/A", "#N/A", "#N/A"},7,FALSE)
4

1 回答 1

1

VLOOKUP正在函数Sausage返回的数组中查找。IF该数组包含column 中的A2:H4032所有行。ChickenA

由于Sausage永远不等于Chicken,因此您永远不会得到结果。

VLOOKUPSausage在数组的第一列中查找第一个参数。

从评论插入:

在链接中,条件(地区)South-America 用于条件中,项目 A 用于 vlookup 以获取公司名称(3 件事)。您使用鸡肉作为条件,香肠作为 vlookup 来取回什么?此外,当您在 vlookup 中查找某些内容时,该内容必须位于数组的第一列。在示例中,区域位于第一列!

我不确定你想要得到什么,但要么移动一些列以在 A 列中制作“香肠”,要么更改返回的数组,IF使第一列包含“香肠”。

于 2013-08-14T10:25:42.040 回答