简体   繁体   English

如何计算某些行范围之间的数字?

[英]how to count number between certain range of rows?

i would like to count number for every 7 rows, data are in one column. 我想计算每7行的数字,数据在一列。 i use this formula, but it is not working. 我使用这个公式,但它不起作用。

from B8 to B14329 , for every 7 rows, count number if it is equal to 3. so i know how many 3 in every 7 rows. B8B14329 ,对于每7行,如果它等于3则计数。所以我知道每7行中有3个。

=COUNTIFS(B8:B14329, OFFSET($B$7,(ROW()-12)*7,0,7,1),B8:B14329,=3)

Thanks a lot! 非常感谢! i want something like this: 我想要这样的东西:

data  count
3    
2   
3   
1   
3   
3   
1       4
1   
2   
2   
3   
3   
1   
1       2
.....
....
...

Simple and easy: 简单易用:

=SUMPRODUCT((B8:B14329=3)*(MOD(ROW(B8:B14329),7)=1))

Just change the =1 to your needs. 只需根据您的需要更改=1即可。 To start with row 1 =1 , 2 =2 ... 6 =6 , 7 =0 . 从第1行开始=1 1,2 =2 ... 6 =6 =0 This way, to start count at row 8 it is =1 这样,为了在第8行开始计数,它是=1

EDIT : having your exaple now, you want something completely different... lol. 编辑 :现在有你的exaple,你想要一些完全不同的东西......哈哈。

=IF(MOD(ROW(),7)=0,COUNTIF(A8:A14,3),"")

Put this in row 14 and then drag down... change the =0 as you need it. 将其放入第14行,然后向下拖动...根据需要更改=0

Here's what I would do 这就是我要做的

  • Add a new column with the row index (8 to 14239) in your case 在您的情况下添加一个带有行索引(8到14239)的新列
  • Add Yet another column, with a formula to tell whether the column you just added is a multiple of 7. Put it's value like "TRUE" or "FALSE" 添加另一列,使用公式来判断您刚刚添加的列是否为7的倍数。将其值设置为“TRUE”或“FALSE”

You can use the MOD function to check the remainder of the division. 您可以使用MOD功能检查除法的其余部分。

= MOD ( Number , Divisor )

By now, you should have, aside from the columns you already have, something like: 到目前为止,除了已有的列之外,你应该有:

8-----FALSE

9-----FALSE

10-----FALSE

11-----FALSE

12-----FALSE

13-----FALSE

14-----TRUE

15-----FALSE

Once you have that, just apply a filter on the "TRUE/FALSE" column, select the "TRUE" values and you will be able to count the number of "3"s on the actual value column, by also using a filter on it. 完成后,只需在“TRUE / FALSE”列上应用过滤器,选择“TRUE”值,您就可以通过使用过滤器来计算实际值列中“3”的数量。它。

I hope it helps, and it's easier than a really messy formula. 我希望它有所帮助,它比一个非常混乱的公式更容易。

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

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