简体   繁体   English

v 在单个单元格中查找多个值并返回值

[英]vLookup multiple values in a single cell and return value

i have 2 worksheets, the first one containing a list of bill number & amount for eg我有 2 个工作表,第一个包含账单编号和金额列表,例如

bill no     Amount
0001        100
0002        50
0003        80
0004        40
0005        90
-----and so on-----

the second sheet contains,第二张纸包含,

Bill No                   Amount     chq number                
0001,0002,0005    =       240        123456789

i want a formula in sheet one, which will look up the bill number in sheet 02 if its true then return the value in a cell我想要一张表中的公式,如果它为真,它将在表 02 中查找账单编号,然后返回单元格中的值

A formula you can use is您可以使用的公式是

=SUMPRODUCT(IFERROR(SEARCH(RIGHT(sheet1!billNo,4),sheet2!billNoRange),0)>0,sheet2!amountRange)

Basically, you're trying to find the bill number from sheet 1 and searching for a match on the sheet 2 bill number range.基本上,您正在尝试从工作表 1 中查找帐单编号并在工作表 2 的帐单编号范围内搜索匹配项。 You need to use the right 4 digits of the sheet1 bill number to avoid errors with the apostrophe.您需要使用 sheet1 帐单编号的正确 4 位数字,以避免出现撇号错误。 If you find a match in the cell, it be greater than 1 and evaluate as TRUE (or 1).如果您在单元格中找到匹配项,则它大于 1 并评估为 TRUE(或 1)。 If there is not match it will evaluate to FALSE (or 0) then it will multiply it by the amount range.如果不匹配,它将评估为 FALSE(或 0),然后将其乘以数量范围。 This will give you the sum of all matches.这将为您提供所有匹配项的总和。

Hope this helps.希望这可以帮助。 Here's an article on SUMPRODUCT if you need more info.如果您需要更多信息,这里有一篇关于SUMPRODUCT的文章。

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

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