简体   繁体   English

Excel复杂计数功能

[英]Excel complicated count function

I have kind of a complicated count I can't seem to figure out. 我有点复杂,我似乎无法弄清楚。 Basically I have a table that looks similar to this image: 基本上,我有一张看起来与此图像相似的表:

样本数据

Now what I need to do is: 现在我需要做的是:

  1. Tally the number of 1's if the category = "Anon" in one cell, then count the number of 2's and 3's in separate cells all if the category = "Anon". 如果类别=“ Anon”在一个单元格中计算1的数目,然后在类别=“ Anon”时在单独的单元格中计算2和3的数目。
  2. Wash/Rinse/Repeat for if it's "Watterson" and "Davis". 如果是“ Watterson”和“ Davis”,请清洗/漂洗/重复。

Is there any way I can count the occurrences of 1|2|3 and have it separated by category like this? 我有什么办法可以计算1 | 2 | 3的出现并按类别将其分开?

Sorry, kind of an Excel noob here. 抱歉,这里有点Excel菜鸟。 I didn't think pivot tables would be correct though (especially because they want the dates to be columns, plus I couldn't figure out how to insert a conditional). 我并不认为数据透视表会是正确的(特别是因为它们希望日期为列,再加上我无法弄清楚如何插入条件表)。 Any pointers in the right direction would be appreciated. 朝正确方向的任何指针将不胜感激。

Let's suppose that your screenshot shows cells A1:I6. 假设您的屏幕截图显示了单元格A1:I6。

Then ... 然后 ...

  • Add column headings "1", "2", "3" in cells J1:L1 在单元格J1:L1中添加列标题“ 1”,“ 2”,“ 3”
  • Put the formula =COUNTIF($C2:$I2,J$1) into J2 and copy it across and down 将公式=COUNTIF($C2:$I2,J$1)放入J2,然后向下复制
  • Set up a list of unique Categories (Anon, Watterson etc) starting in A10 设置从A10开始的唯一类别(Anon,Watterson等)的列表
  • Add headings in row 9 like "Category", "Tally of 1s", "Tally of 2s", "Tally of 3s" 在第9行中添加标题,例如“类别”,“ 1s总计”,“ 2s总计”,“ 3s总计”
  • Put the formula =SUMIF($B$2:$B$6,$A10,J$2:J$6) into B10 and copy it across and down 将公式=SUMIF($B$2:$B$6,$A10,J$2:J$6)放入B10,然后将其复制并向下复制

My guess is that someone cleverer than I could construct a sumproduct formula for B10 that works without the need for the helper columns J:L. 我的猜测是,比我聪明的人可以为B10构造一个sumproduct公式,而无需使用助手列J:L。

[Edit] Using Maki's sumproduct formula in my structure, you can scrap helper values in cols J:I and put this into B10 -- =SUMPRODUCT(($B$2:$B$6=$A10)*($C$2:$I$6=B$9)) [编辑]在我的结构中使用Maki的sumproduct公式,可以在cols J:I中sumproduct辅助值并将其放入B10中=SUMPRODUCT(($B$2:$B$6=$A10)*($C$2:$I$6=B$9))

assuming that you start from cell A1, 假设您从单元格A1开始,

=SUMPRODUCT((list name to search for)*(value to search in the data area)) = SUMPRODUCT((要搜索的列表名称)*(要在数据区域中搜索的值))

=SUMPRODUCT(($B$2:$B$6="Anon")*($C$2:$I$6=1))
=SUMPRODUCT(($B$2:$B$6="Anon")*($C$2:$I$6=2))

... ...

=SUMPRODUCT(($B$2:$B$6="Watterson")*($C$2:$I$6=1))

...etc. ...等等。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM