[英]MS Excel: Count the number of cells in a column that have the same number as the cell to the left of it
How can I do to count the number of cells in a column, that have the same text as the cell to the left of it? 如何计算一列中与其左侧的单元格具有相同文本的单元格的数量?
Seems it should be pretty simple but I can't find a way or any answer online. 似乎应该很简单,但我找不到在线方法或任何答案。 Thank you.
谢谢。
=COUNTIF(P$2:P$125,"="&$O2)
= COUNTIF(P $ 2:P $ 125,“ =”&$ O2)
=COUNTIF(P$2:P$125,"="&$O2)
This is almost perfect except the formula tries to match always with cell value of O2. 除了公式试图始终与O2的像元值匹配之外,这几乎是完美的。 Which is great for P2, but when I get to P99 for example, I want to see if it is exactly the same as O99, and similarly then equal.
这对P2来说很棒,但是例如当我到达P99时,我想看看它是否与O99完全相同,并且类似然后相等。
Use SUMPRODUCT and limit the ranges to the extents of the data while maintaining the same size of range for both columns. 使用SUMPRODUCT并将范围限制为数据范围,同时保持两列的范围大小相同。
=SUMPRODUCT(--(O$2:O$125=P$2:P$125))
'dynamic range
=SUMPRODUCT(--(O$2:index(O:O, match("zzz", O:O))=P$2:index(P:P, match("zzz", O:O))))
The --
(or double unary ) coverts the TRUE/FALSE results to ones and zeroes. --
(或双一进制 )将TRUE / FALSE结果转换为1和0。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.