比较Google表格中的列以查找共同值(数量)和唯一值(数量)。

huangapple go评论49阅读模式
英文:

Comparing columns in Google sheets to find common values (number of) and unique values (number of)

问题

I want to make the two tables on the right using the information in the table on the left.

第一个表格显示有多少人具有相同的颜色值。
例如,有多少人是红色和蓝色的。

第二个表格排除了那些拥有两种相同颜色的人,只关注唯一的人。
例如,有多少人是红色但不是蓝色的(反之亦然)。

我正在努力找出要使用的公式...以及是否需要中间步骤。

我尝试过Vlookup,但不确定在这种情况下是否需要它。我不熟悉所有的Google表格公式选项,也无法从Google搜索或YouTube搜索中找到适用于这种情况的解决方法。

表格链接:
Google Sheets

英文:

I've got a big dataset so made a smaller example to explain.

Basically I want to make the two tables on the right using the information in the table on the left.

The first table shows how many people have common values for color.
Eg. How many people are in Red and Blue.

The second table excludes the people who have the two colors in common and only looks at the unique ones.
Eg. How many people who are in Red but not in Blue (and vice versa).

I'm struggling to figure out the formulas to use...and whether I need an interim step or not.

Screenshot

I've tried Vlookup but not sure it's what I need in this case. Am not familiar with all the google sheet formula options and couldn't find something that helped with this particular case from googling or searching youtube.

Link to sheet:
Google Sheets

答案1

得分: 1

  • Greencolumn_B 中有尾随空格字符,您可能需要修复(在截图中突出显示)
  • 在应用这些公式到单元格 F3F12 之前,请清除范围 F3:I6F12:I15
  • 几个公式导出的输出值与您手动输入的期望输出不同,您可能需要仔细检查

F3 公式

=makearray(counta(E3:E6),counta(F2:I2),lambda(r,c,if(index(E3:E6,r)=index(F2:I2,,c),, let(Σ,filter(A:A,B:B=index(E3:E6,r)),counta(ifna(filter(Σ,xmatch(Σ,filter(A:A,B:B=index(F2:I2,,c))))))))))

F12 公式

=makearray(counta(E3:E6),counta(F2:I2),lambda(r,c,if(index(E3:E6,r)=index(F2:I2,,c),, let(Σ,filter(A:A,B:B=index(F2:I2,,c)),counta(filter(Σ,iserror(xmatch(Σ,filter(A:A,B:B=index(E3:E6,r))))))))))

英文:

You may try:

  • Green has trailing space character in column_B which you may want to fix (highlighted in screenshot)
  • Clear the ranges F3:I6 & F12:I15 prior to applying these formulas in Cells F3 & F12
  • couple of formula-derived output values are different from your manually entered expected output; which you may need to double check

F3 formula:

=makearray(counta(E3:E6),counta(F2:I2),lambda(r,c,if(index(E3:E6,r)=index(F2:I2,,c),,
          let(Σ,filter(A:A,B:B=index(E3:E6,r)),counta(ifna(filter(Σ,xmatch(Σ,filter(A:A,B:B=index(F2:I2,,c))))))))))

F12 formula:

=makearray(counta(E3:E6),counta(F2:I2),lambda(r,c,if(index(E3:E6,r)=index(F2:I2,,c),,
          let(Σ,filter(A:A,B:B=index(F2:I2,,c)),counta(filter(Σ,iserror(xmatch(Σ,filter(A:A,B:B=index(E3:E6,r))))))))))

比较Google表格中的列以查找共同值(数量)和唯一值(数量)。

huangapple
  • 本文由 发表于 2023年4月20日 00:18:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76056769.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定