简体   繁体   English

Excel公式返回特定值

[英]Excel Formula to return a Specific Value

I am encountering a small problem in excel. 我在excel中遇到一个小问题。 I am making a sheet in excel using various formulas but got stuck at a point. 我正在使用各种公式在excel中制作一张工作表,但遇到了困难。

My query is: I have a "Name" in Cell say B2. 我的查询是:我在单元格B2中有一个“名称”。 On the other sheet, there is a table which consists of lots of names. 在另一张纸上,有一个包含许多名称的表。

I need a formula in cell F2 which will look the value in Cell B2 in the table and if it matches, then cell F2 will show the result by multiplying cell D2 and E2. 我在单元格F2中需要一个公式,该公式将在表中的单元格B2中查找值,如果匹配,则单元格F2将单元格D2和E2相乘将显示结果。 If the value is not located in a table, then the result will be 0. 如果该值不在表中,则结果将为0。

Please help me out in it as i have tried both vlookup and index match. 请帮我解决这个问题,因为我已经尝试了vlookup和索引匹配。

Thanks Salman Khan 感谢Salman Khan

Im not on excel now, but ill give you the algorythm yo solve your problem. 我现在不在excel上,但是请您用算法解决问题。 I would like to assume you know the ff functions that i will mention. 我想假设您知道我将要提到的ff函数。

If( vlookup(B2, sheet2!A:A, 1, 0) != "#N/A", D2*E2, "Not found" )

Im not sure if that is the exact formula but thats the algo fir that.. 我不确定这是否是确切的公式,但这就是算法。

Enter this into cell F2 : 将其输入单元格F2

=IF(COUNTIF(Sheet2!$A$2:$A$6,B2)=1, D2*E2, 0)

This assumes that your list of names is located in Sheet2 in the range A2:A6 (hence just 5 names in my example). 假设您的姓名列表位于Sheet2A2:A6范围内(因此在我的示例中只有5个姓名)。

Make certain that you use absolute cell referencing in Sheet2 when you copy this formula to the other cells in your F column. 将公式复制到F列中的其他单元格时,请确保在Sheet2使用绝对单元格引用。

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

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