[英]Compare two Excel columns A&B and add in one cell the data of a third column C of the entries not present in A
I have three columns, two of them are a list of countries. 我有三列,其中两列是国家列表。 The third column is a list of numbers corresponding to the countries in column A. The formula should compare column A and C and add in a single cell the numbers of the countries not present in list C when compared to A. I want the output to be only one cell, not a list. 第三列是与A列中的国家相对应的数字的列表。该公式应比较A列和C列,并在单个单元格中添加与A相比时列表C中不存在的国家的数字。我希望输出为只能是一个单元格,而不是列表。 I've tried with Index & Match and with a Sumproduct and Sumif but I haven't been able to make it work, maybe my syntax was bad. 我已经尝试过使用Index&Match以及Sumproduct和Sumif,但是我无法使其工作,也许我的语法不好。 Thanks! 谢谢!
A B C Output
Austria 1000 Belgium 6000
Belgium 2000 Spain
Spain 3000 Portugal
Portugal 4000
United Kingdom 5000
As said in the comment: 如评论中所述:
{=SUM(B1:B10)-SUM(SUMIF(A1:A10,TRANSPOSE(C1:C10),B1:B10))}
will do the job... 会做...
being able to run tests, it works even without TRANSPOSE
: 能够运行测试,即使没有TRANSPOSE
也可以工作:
{=SUM(B1:B10)-SUM(SUMIF(A1:A10,C1:C10,B1:B10))}
or without sumif: (will be slow / uses lots of resources) 或不使用sumif :(会很慢/使用大量资源)
{=SUM(B1:B10)-SUM((A1:A10=TRANSPOSE(C1:C10))*B1:B10)}
Looking for a way without the '-'
: 寻找一种没有'-'
:
It is hard to exclude something, because you would need an AND
or something like that which is only working column or row-wise (and that doesn't exist)... so it is easier to collect every match and then simply subtract it from the unfiltered list... but if you really want to do it that way: 很难排除某些东西,因为您将需要一个AND
或类似的东西,这些东西仅适用于按列或按行(并且不存在)...因此收集每个匹配项然后将其简单相减会更容易从未过滤的列表中...但是如果您真的想这样做:
{=SUM(IF(ISERROR(MATCH(A1:A10,C1:C10,0)),B1:B10))}
=SUMPRODUCT(ISERROR(MATCH(A1:A10,C1:C10,0))*1,B1:B10)
Still, it doesn't look very pretty to me while the last one avoids the CSE... 不过,对我来说,它看起来并不漂亮,而最后一个避免了CSE ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.