[英]Excel Sum Range Match Lookup
I have the following table in excel: 我在excel中有下表:
__|______A_______|_________B___________|____C____|
1 |Client | Description | Amount |
2 |Client One | Water Services | 50 |
3 |Client One | Installation Fees | 120 |
4 |Client One | Telephone Services | 130 |
5 |Client Two | Food Services | 20 |
6 |Client Two | Pump Installation | 40 |
7 |Client Two | Door Installation | 100 |
8 |Client Three | Telephone Services | 98 |
9 |Client Three | Gas Services | 34 |
10|Client Three | Installation Fees | 46 |
I need a formula to calculate the total amount of services for each client and total amount of installation for each client in a second worksheet. 我需要一个公式来计算第二个工作表中每个客户端的服务总量和每个客户端的安装总量。 For example it should check if the description contains the text "services" in the column B then return the total amount for the client as follows: 例如,它应检查描述是否在B列中包含文本“服务”,然后返回客户的总金额,如下所示:
__|____A________|______B_________|______C_______|
1 |Client | Description | Total Amount |
2 |Client One | Services | 180 |
3 |Client One | Installation | 120 |
4 |Client Two | Services | 20 |
5 |Client Two | Installation | 140 |
6 |Client Three | Services | 132 |
7 |Client Three | Installation | 46 |
I have tried the following formula, but I was able to only return the first value for the client and the description (Column B) in sheet 1 has to contain the exact text, that is either "Services" or "Installation": 我尝试了以下公式,但是我只能返回客户端的第一个值,并且工作表1中的描述(B列)必须包含确切的文本,即“服务”或“安装”:
=INDEX(Sheet1!C2:C10,MATCH(A2&B2,Sheet1!A2:A10&Sheet1!B2:B10,0))
I support the solution by CallumDA, as I'm personally a fan of array formulas. 我支持CallumDA的解决方案,因为我个人是数组公式的粉丝。 However, since the nature of OP's questions suggests somewhat limited Excel-experience, I think Array formulas might be aiming a bit high. 但是,由于OP问题的性质表明Excel经验有限,所以我认为Array公式的目标可能会更高。
A, in my opinion, simpler alternative is to use SUMIFS -formula, eg A,在我看来,更简单的选择是使用SUMIFS -式,例如
=SUMIFS($C$2:$C$10;$A$2:$A$10;"Client One";$B$2:$B$10;"*Service*")
Just replace the "Client One" with the range of the other table where you have the clients listed, and I believe you should be good to go. 只需用列出了客户的另一张表的范围替换“客户一号”,我相信您应该很好。 Also, note that the asterix on either side of Service function as wildcards so that you get both "Water Service", "Service Truck" and other combinations... 另外,请注意, 服务任一侧的星号都用作通配符,因此您可以同时获得“供水服务”,“服务卡车”和其他组合...
You could do something with SUMIF . 您可以使用SUMIF做一些事情。 You could do something like this to get all of your Client One entries 您可以执行以下操作来获取所有的Client One条目
=SUMIF(A2:A10,"Client One",C2:C10)
And to get all of your Client One and Services you could do something like this with ISNUMBER(SEARCH) and SUMIFS 为了获得所有的Client One和服务,您可以使用ISNUMBER(SEARCH)和SUMIFS做这样的事情
First add an extra column for "Is a Service" with this formula 首先使用此公式为“是服务”添加额外的一列
=ISNUMBER(SEARCH("Service",B1))
=ISNUMBER(SEARCH("Service",B2))
...
This will return true/false and then do SUMIFS like this 这将返回true / false,然后像这样执行SUMIFS
=SUMIFS(A2:A10,C2:C10,"Client One",D2:D10,"TRUE")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.