简体   繁体   English

从几组数据中,将每个Id的最大数字相加

[英]From several sets of data, sum the highest numbers for each Id

I have 3 sets of data, all consisting of 1 column with a list of unique IDs and the other with integers. 我有3组数据,所有数据都包含1列,其中包含唯一ID列表,另一列包含整数。 Some of the unique IDs (with their integer) appear in more than 1 set, others don't. 一些唯一ID(带有整数)出现在1组以上,有些则不出现。

ColA        ColB        ColD        ColE        ColF        ColG
UniqueIDs1  Integers1   UniqueIDs2  Integers2   UniqueIDs3  Integers3

I want to sum all the integers in all sets, BUT if there's a duplicate, only sum the highest between the 3 (or the 2 if the match is only between 2 sets). 我想对所有集合中的所有整数求和,但是如果有重复,则只有3之间的最高值(如果匹配仅在2集之间则为2)。

How can I do that? 我怎样才能做到这一点?

The following formula computes such a sum. 以下公式计算这样的总和。

=sum(query({A:B; D:E; F:G}, "select max(Col2) group by Col1"))
  1. {A:B; D:E; F:G} {A:B; D:E; F:G} stacks the columns of your sheet (you may want to use A2:B if 1st row are headers). {A:B; D:E; F:G}堆叠工作表的列(如果第一行是标题,则可能需要使用A2:B)。 The result is an array with two columns, Id in Col1, and integer in Col2. 结果是一个包含两列的数组,在Col1中为Id,在Col2中为整数。
  2. Query selects the maximal element of second column for each Id. Query为每个Id选择第二列的最大元素。
  3. Sum adds those. Sum添加了那些。

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

相关问题 查找数字总和最高的行名 - Find the row name with the highest sum of numbers 计算每个日期的值的总和,并返回最高的总和 - Calculate the sum of values for each date, and return the highest sum 范围内的最高排名-范围内的两个匹配数据集 - Highest rank within a range - two matching data sets in range 我需要把每支球队的 N 个最高球员的分数相加 - I need to sum N highest players' score of each team 从每个名字或组中找到最高数字的行,这些名字或组具有一些相似的名字,然后将它们的值相加 - Find the row of highest numbers from each of names or group who'd has been have a some of similarity of names then sumif their values group of names 动态求和每行 5 个最大的数字 - Sum 5 largest numbers in each row, dynamically 每个唯一值的逗号分隔数字的总和 - SUM of comma separated numbers for each unique value 最高总和数组列表 - Highest Sum Array List Google 表格 Forumla - 如何使用 2 列中的数据获取每行的唯一总和? - Google sheets Forumla - How to get unique sum for each row using data from 2 columns? 使用发票编号数组创建发票对象,其中初始数组中的每个发票编号用作 id 属性 - Use array of invoice numbers to create invoice objects within which each invoice number from the initial array serves as id property
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM