[英]If cell equals with a value in another cell then cellX
i am trying to use IF in the following arguement: 我试图在以下论点中使用IF:
I have a sheet with a list of products next to it a list with manufacturer. 我有一张工作表,上面有产品列表,旁边是制造商列表。 In each product corresponds to a certain manufacturer of the list.
在每个产品对应于某个制造商的列表中。
Now how i can tell a cell that if it found in the cell A1 on another sheet the a value from the list of products in the previous sheet to give me as a result the corresponded manufacturer. 现在,我如何告诉一个单元格,如果它在另一张表的单元格A1中找到,则它是上一张表中产品列表中的一个值,作为结果给我相应的制造商。
I tried the following as a test: 我尝试了以下作为测试:
=IF(COUNTIF(B9;data!A:A);data!B:B;"product not found")
were B9 is the cell that i put the product manually, data!A:A is the range of the sheet that i have the list of the products and data!B:B is the list with the manufucturers. B9是我手动放置产品的单元格,数据!A:A是我拥有产品和数据列表的图纸范围!B:B是制造商的列表。
The syntax i guess is ok since its working properly in excel but the thing is that i get always (product not found). 我猜语法是可以的,因为它可以在excel中正常工作,但问题是我总是得到(找不到产品)。
Could please someone help me? 可以请人帮我吗? Thanks in advance!
提前致谢!
I believe you are looking for either Vlookup
(to find the corresponding manufacturer), or countif
to say whether a manufacturer exists or not. 我相信您正在寻找
Vlookup
(以找到相应的制造商),或者在countif
上寻找制造商是否存在。
First: Countif()
首先:
Countif()
=if(Countif(data!A:A, B9)=0;"Product has mfg", "Product not found")
Second: vlookup()
第二:
vlookup()
=Vlookup(B9, Data!A:B, 2, false)
That vlookup
will return the manufacturer, if one exists, if it doesn't then you will get an error. 如果存在,则该
vlookup
将返回制造商,如果不存在,则将出现错误。 It does this by looking up the b9
value in the first column of the range DATA!A:B
. 它通过在范围
DATA!A:B
的第一列中查找b9
值来实现。 When it finds the value, it returns data from the second column (because we put 2
as the third parameter). 找到值时,它从第二列返回数据(因为我们将
2
作为第三个参数)。
If you want to catch the error when the product doesn't have a manufacturer you can wrap the vlookup
in an iferror()
like: 如果你想赶上错误当产品没有制造商可以包裹
vlookup
在iferror()
如:
=IfError(Vlookup(B9, Data!A:B, 2, false), "Product not found")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.