简体   繁体   English

比较两个Excel列A&B,并在一个单元格中添加A中不存在的条目的第三列C的数据

[英]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.

相关问题 比较两列并在Excel中填写第三列 - Compare two columns and fill in the third column in Excel Excel-如何比较2列中的单元格,如果B列匹配,则使用B列中匹配单元格旁边的C列中的值? - Excel - How to Compare Cells from 2 Columns then if Column B Matches, Use the Value in Column C next to the Matching Cell in Column B? Excel尝试在两个不同的工作表中比较两个列并从第三列返回数据 - Excel trying to two compare columns in two different worksheets and return data from third column Excel:比较两列(名称列表),在第三列合并 - Excel: Compare two columns (namelists), combine in third column 如何在Excel中将两列数据添加到一列中? - How to add two columns data to one column in excel? 需要比较两列并用一张表中的数据完成第三列 - Need to compare two columns and complete a third with data from one the sheets Excel-匹配两列,从第三列添加值,并附加不匹配的数据 - Excel - Match two columns, add value from third column and also append the unmatched data 比较两列 A 和 B 以获取 3 列 C、D 和 E 中的数据 - Compare two columns A and B to get data in 3 columns, C,D & E Excel / VBA比较两列并将单元格内容从第三列复制到两张不同工作表中的第四列 - Excel/VBA Comparing two columns and copying the cell contents from a third column into a fourth column in two different sheets 比较两列并列出第三列 - Compare two columns and list a third column
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM